aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_i64_varargs.in
blob: a0cbec64a0b9da7fa18e83b53f50395e49a8004b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>

int64_t ccv_cache_generate_signature(char *msg, int len, int64_t sig_start,
                                     ...) {
  if (sig_start < 10123) printf("%s\n", msg + len);
  va_list v;
  va_start(v, sig_start);
  if (sig_start > 1413)
    printf("%d\n", va_arg(v, int));
  else
    printf("nada\n");
  va_end(v);
  return len * sig_start * (msg[0] + 1);
}

int main(int argc, char **argv) {
  argv[0] = "...";
  for (int i = 0; i < argc; i++) {
    int64_t x;
    if (i % 123123 == 0)
      x = ccv_cache_generate_signature(argv[i], i + 2, (int64_t)argc * argc,
                                       54.111);
    else
      x = ccv_cache_generate_signature(argv[i], i + 2, (int64_t)argc * argc,
                                       13);
    printf("%lld\n", x);
  }
};