#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
size_t omp_capture_affinity(char *, int, char const *);
int /*<<< orphan*/ omp_display_affinity(char const *);
size_t omp_get_affinity_format(char *, int);
int omp_get_ancestor_thread_num(int);
int omp_get_level();
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ omp_set_affinity_format(char const *);
scalar_t__ snprintf(char *, int, char *, int, int, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char const *);
size_t strlen(char const *);
int main(int argc, char **argv) {
  char buf[1024];
  size_t needed, length;
  const char *format = "tl:%L tn:%n nt:%N an:%a";
  const char *second_format =
      "nesting_level:%{nesting_level} thread_num:%{thread_num} "
      "num_threads:%{num_threads} ancestor_tnum:%{ancestor_tnum}";
  length = strlen(format);
  omp_set_affinity_format(format);
  needed = omp_get_affinity_format(buf, 1024);
  if (!((!strcmp(buf, format)))) {
    fprintf(stderr,
            "error: %s: %d: "
            "(!strcmp(buf, format))"
            "\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
            "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
            "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
            "format/api2.c",
            37);
    exit(1);
  };
  if (!(needed == length)) {
    fprintf(stderr,
            "error: %s: %d: "
            "needed == length"
            "\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
            "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
            "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
            "format/api2.c",
            38);
    exit(1);
  }
  omp_get_affinity_format(buf, 5);
  if (!((!strcmp(buf, "tl:%")))) {
    fprintf(stderr,
            "error: %s: %d: "
            "(!strcmp(buf, \"tl:%\"))"
            "\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
            "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
            "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
            "format/api2.c",
            42);
    exit(1);
  };
#pragma omp parallel
  {
    char my_buf[512];
    char supposed[512];
    int tl, tn, nt, an;
    size_t needed, needed2;
    tl = omp_get_level();
    tn = omp_get_thread_num();
    nt = omp_get_num_threads();
    an = omp_get_ancestor_thread_num(omp_get_level() - 1);
    needed = omp_capture_affinity(my_buf, 512, NULL);
    needed2 = (size_t)snprintf(supposed, 512, "tl:%d tn:%d nt:%d an:%d", tl, tn,
                               nt, an);
    if (!((!strcmp(my_buf, supposed)))) {
      fprintf(stderr,
              "error: %s: %d: "
              "(!strcmp(my_buf, supposed))"
              "\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
              "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
              "format/api2.c",
              56);
      exit(1);
    };
    if (!(needed == needed2)) {
      fprintf(stderr,
              "error: %s: %d: "
              "needed == needed2"
              "\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
              "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
              "format/api2.c",
              57);
      exit(1);
    };
    supposed[4] = '\0';
    omp_capture_affinity(my_buf, 5, NULL);
    if (!((!strcmp(my_buf, supposed)))) {
      fprintf(stderr,
              "error: %s: %d: "
              "(!strcmp(my_buf, supposed))"
              "\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
              "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
              "format/api2.c",
              61);
      exit(1);
    };
    needed = omp_capture_affinity(my_buf, 512, second_format);
    needed2 = (size_t)snprintf(
        supposed, 512,
        "nesting_level:%d thread_num:%d num_threads:%d ancestor_tnum:%d", tl,
        tn, nt, an);
    if (!((!strcmp(my_buf, supposed)))) {
      fprintf(stderr,
              "error: %s: %d: "
              "(!strcmp(my_buf, supposed))"
              "\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
              "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
              "format/api2.c",
              65);
      exit(1);
    };
    if (!(needed == needed2)) {
      fprintf(stderr,
              "error: %s: %d: "
              "needed == needed2"
              "\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
              "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
              "format/api2.c",
              66);
      exit(1);
    };
    supposed[25] = '\0';
    omp_capture_affinity(my_buf, 26, second_format);
    if (!((!strcmp(my_buf, supposed)))) {
      fprintf(stderr,
              "error: %s: %d: "
              "(!strcmp(my_buf, supposed))"
              "\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "bb-clusters/Fujitsu/benchmarks/resnet/implementations/"
              "implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/"
              "format/api2.c",
              71);
      exit(1);
    };
  }
#pragma omp parallel num_threads(4)
  {
    omp_display_affinity(NULL);
    omp_display_affinity(second_format);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe10(%rip),%rax
mov    %rax,-0x428(%rbp)
lea    0xe1a(%rip),%rax
mov    %rax,-0x430(%rbp)
mov    -0x428(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x420(%rbp)
mov    -0x428(%rbp),%rdi
call   10d0 <omp_set_affinity_format@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1070 <omp_get_affinity_format@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x428(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1283 <main+0xb3>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
lea    0xe42(%rip),%rdx
mov    $0x25,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x418(%rbp),%rax
cmp    -0x420(%rbp),%rax
je     12c2 <main+0xf2>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
lea    0xf0d(%rip),%rsi
lea    0xe03(%rip),%rdx
mov    $0x26,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x410(%rbp),%rdi
mov    $0x5,%esi
call   1070 <omp_get_affinity_format@plt>
lea    -0x410(%rbp),%rdi
lea    0xef4(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     131a <main+0x14a>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
lea    0xedb(%rip),%rsi
lea    0xdab(%rip),%rdx
mov    $0x2a,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    $0x0,%al
call   10e0 <omp_get_level@plt>
mov    %eax,-0x834(%rbp)
mov    $0x0,%al
call   1050 <omp_get_thread_num@plt>
mov    %eax,-0x838(%rbp)
mov    $0x0,%al
call   1090 <omp_get_num_threads@plt>
mov    %eax,-0x83c(%rbp)
mov    $0x0,%al
call   10e0 <omp_get_level@plt>
mov    %eax,%edi
sub    $0x1,%edi
call   1030 <omp_get_ancestor_thread_num@plt>
mov    %eax,-0x840(%rbp)
lea    -0x630(%rbp),%rdi
mov    $0x200,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <omp_capture_affinity@plt>
mov    %rax,-0x848(%rbp)
lea    -0x830(%rbp),%rdi
mov    -0x834(%rbp),%ecx
mov    -0x838(%rbp),%r8d
mov    -0x83c(%rbp),%r9d
mov    -0x840(%rbp),%eax
mov    $0x200,%esi
lea    0xe60(%rip),%rdx
mov    %eax,(%rsp)
call   1080 <snprintf@plt>
mov    %rax,-0x850(%rbp)
lea    -0x630(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     13f7 <main+0x227>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xe3d(%rip),%rsi
lea    0xcce(%rip),%rdx
mov    $0x38,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x848(%rbp),%rax
cmp    -0x850(%rbp),%rax
je     1436 <main+0x266>
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
lea    0xc8f(%rip),%rdx
mov    $0x39,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movb   $0x0,-0x82c(%rbp)
lea    -0x630(%rbp),%rdi
mov    $0x5,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <omp_capture_affinity@plt>
lea    -0x630(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1499 <main+0x2c9>
mov    0x2b6b(%rip),%rax
mov    (%rax),%edi
lea    0xd9b(%rip),%rsi
lea    0xc2c(%rip),%rdx
mov    $0x3d,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x630(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    $0x200,%esi
call   1040 <omp_capture_affinity@plt>
mov    %rax,-0x848(%rbp)
lea    -0x830(%rbp),%rdi
mov    -0x834(%rbp),%ecx
mov    -0x838(%rbp),%r8d
mov    -0x83c(%rbp),%r9d
mov    -0x840(%rbp),%eax
mov    $0x200,%esi
lea    0xd82(%rip),%rdx
mov    %eax,(%rsp)
call   1080 <snprintf@plt>
mov    %rax,-0x850(%rbp)
lea    -0x630(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     153b <main+0x36b>
mov    0x2ac9(%rip),%rax
mov    (%rax),%edi
lea    0xcf9(%rip),%rsi
lea    0xb8a(%rip),%rdx
mov    $0x41,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x848(%rbp),%rax
cmp    -0x850(%rbp),%rax
je     157a <main+0x3aa>
mov    0x2a8a(%rip),%rax
mov    (%rax),%edi
lea    0xce6(%rip),%rsi
lea    0xb4b(%rip),%rdx
mov    $0x42,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movb   $0x0,-0x817(%rbp)
lea    -0x630(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    $0x1a,%esi
call   1040 <omp_capture_affinity@plt>
lea    -0x630(%rbp),%rdi
lea    -0x830(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     15e0 <main+0x410>
mov    0x2a24(%rip),%rax
mov    (%rax),%edi
lea    0xc54(%rip),%rsi
lea    0xae5(%rip),%rdx
mov    $0x47,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <omp_display_affinity@plt>
mov    -0x430(%rbp),%rdi
call   10c0 <omp_display_affinity@plt>
xor    %eax,%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
lea    0xe48(%rip),%rdi
call   10c0 <omp_set_affinity_format@plt>
lea    0x420(%rsp),%rdi
mov    $0x400,%esi
call   1060 <omp_get_affinity_format@plt>
movdqa 0x420(%rsp),%xmm0
movq   0x430(%rsp),%xmm1
pcmpeqb 0xdf7(%rip),%xmm1
pcmpeqb 0xdff(%rip),%xmm0
pand   %xmm1,%xmm0
pmovmskb %xmm0,%ecx
cmp    $0xffff,%ecx
jne    13ef <main+0x22f>
cmp    $0x17,%rax
jne    1410 <main+0x250>
lea    0x420(%rsp),%rdi
mov    $0x5,%esi
call   1060 <omp_get_affinity_format@plt>
mov    $0x253a6c74,%eax
xor    0x420(%rsp),%eax
movzbl 0x424(%rsp),%ecx
or     %eax,%ecx
jne    1431 <main+0x271>
xor    %eax,%eax
call   10d0 <omp_get_level@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <omp_get_thread_num@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1080 <omp_get_num_threads@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   10d0 <omp_get_level@plt>
lea    -0x1(%rax),%edi
call   1030 <omp_get_ancestor_thread_num@plt>
mov    %eax,%ebx
lea    0x220(%rsp),%rdi
mov    $0x200,%esi
xor    %edx,%edx
call   1040 <omp_capture_affinity@plt>
mov    %rax,%r14
mov    %ebx,0x14(%rsp)
mov    %ebx,(%rsp)
lea    0xf71(%rip),%rdx
lea    0x20(%rsp),%r15
mov    %r15,%rdi
mov    $0x200,%esi
mov    %ebp,0x1c(%rsp)
mov    %ebp,%ecx
mov    %r12d,0x18(%rsp)
mov    %r12d,%r8d
mov    %r13d,%r9d
call   1070 <snprintf@plt>
mov    %rax,%rbp
lea    0x220(%rsp),%rdi
mov    %r15,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    1452 <main+0x292>
cmp    %rbp,%r14
jne    1473 <main+0x2b3>
movb   $0x0,0x24(%rsp)
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1040 <omp_capture_affinity@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    1491 <main+0x2d1>
lea    0xd09(%rip),%rdx
lea    0x220(%rsp),%r14
mov    %r14,%rdi
mov    $0x200,%esi
call   1040 <omp_capture_affinity@plt>
mov    %rax,%r15
mov    0x14(%rsp),%eax
mov    %eax,(%rsp)
lea    0xf32(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    0x1c(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    %r13d,%r9d
call   1070 <snprintf@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    14af <main+0x2ef>
cmp    %rbp,%r15
jne    14cd <main+0x30d>
movb   $0x0,0x39(%rsp)
lea    0xc9a(%rip),%rdx
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1a,%esi
call   1040 <omp_capture_affinity@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    14eb <main+0x32b>
xor    %edi,%edi
call   10b0 <omp_display_affinity@plt>
lea    0xc62(%rip),%rdi
call   10b0 <omp_display_affinity@plt>
xor    %eax,%eax
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
lea    0xcab(%rip),%rsi
lea    0xccb(%rip),%rdx
mov    $0x25,%ecx
jmp    1507 <main+0x347>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
lea    0xdb4(%rip),%rsi
lea    0xcaa(%rip),%rdx
mov    $0x26,%ecx
jmp    1507 <main+0x347>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
lea    0xdb9(%rip),%rsi
lea    0xc89(%rip),%rdx
mov    $0x2a,%ecx
jmp    1507 <main+0x347>
mov    0x2b87(%rip),%rax
mov    (%rax),%edi
lea    0xdd7(%rip),%rsi
lea    0xc68(%rip),%rdx
mov    $0x38,%ecx
jmp    1507 <main+0x347>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
lea    0xde2(%rip),%rsi
lea    0xc47(%rip),%rdx
mov    $0x39,%ecx
jmp    1507 <main+0x347>
mov    0x2b48(%rip),%rax
mov    (%rax),%edi
lea    0xd98(%rip),%rsi
lea    0xc29(%rip),%rdx
mov    $0x3d,%ecx
jmp    1507 <main+0x347>
mov    0x2b2a(%rip),%rax
mov    (%rax),%edi
lea    0xd7a(%rip),%rsi
lea    0xc0b(%rip),%rdx
mov    $0x41,%ecx
jmp    1507 <main+0x347>
mov    0x2b0c(%rip),%rax
mov    (%rax),%edi
lea    0xd88(%rip),%rsi
lea    0xbed(%rip),%rdx
mov    $0x42,%ecx
jmp    1507 <main+0x347>
mov    0x2aee(%rip),%rax
mov    (%rax),%edi
lea    0xd3e(%rip),%rsi
lea    0xbcf(%rip),%rdx
mov    $0x47,%ecx
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"tl:%L tn:%n nt:%N an:%a\00"
@.str.1 = [114 x i8] c"nesting_level:%{nesting_level} thread_num:%{thread_num} num_threads:%{num_threads} ancestor_tnum:%{ancestor_tnum}\00"
@stderr = global i32 0
@.str.2 = [39 x i8] c"error: %s: %d: (!strcmp(buf, format))\0A\00"
@.str.3 = [259 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/bb-clusters/Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/format/api2.c\00"
@.str.4 = [33 x i8] c"error: %s: %d: needed == length\0A\00"
@.str.5 = [5 x i8] c"tl:%\00"
@.str.6 = [39 x i8] c"error: %s: %d: (!strcmp(buf, \22tl:%\22))\0A\00"
@.str.7 = [24 x i8] c"tl:%d tn:%d nt:%d an:%d\00"
@.str.8 = [44 x i8] c"error: %s: %d: (!strcmp(my_buf, supposed))\0A\00"
@.str.9 = [34 x i8] c"error: %s: %d: needed == needed2\0A\00"
@.str.10 = [63 x i8] c"nesting_level:%d thread_num:%d num_threads:%d ancestor_tnum:%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [512 x i8]
%12 = alloca [512 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i64
%18 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.1, i64 0, i64 0), i8** %10
%19 = load i8*, i8** %9
%20 = call i64 @strlen(i8* %19)
store i64 %20, i64* %8
%21 = load i8*, i8** %9
%22 = call i32 @omp_set_affinity_format(i8* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%24 = call i64 @omp_get_affinity_format(i8* %23, i32 1024)
store i64 %24, i64* %7
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%26 = load i8*, i8** %9
%27 = call i32 @strcmp(i8* %25, i8* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %2
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 37)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %2
%34 = load i64, i64* %7
%35 = load i64, i64* %8
%36 = icmp eq i64 %34, %35
br i1 %36, label %41, label %37
37: ; preds = %33
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %33
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%43 = call i64 @omp_get_affinity_format(i8* %42, i32 5)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %41
%48 = load i32, i32* @stderr
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 42)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %41
%52 = call i32 (...) @omp_get_level()
store i32 %52, i32* %13
%53 = call i32 (...) @omp_get_thread_num()
store i32 %53, i32* %14
%54 = call i32 (...) @omp_get_num_threads()
store i32 %54, i32* %15
%55 = call i32 (...) @omp_get_level()
%56 = sub nsw i32 %55, 1
%57 = call i32 @omp_get_ancestor_thread_num(i32 %56)
store i32 %57, i32* %16
%58 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%59 = call i64 @omp_capture_affinity(i8* %58, i32 512, i8* null)
store i64 %59, i64* %17
%60 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%61 = load i32, i32* %13
%62 = load i32, i32* %14
%63 = load i32, i32* %15
%64 = load i32, i32* %16
%65 = call i64 @snprintf(i8* %60, i32 512, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %61, i32 %62, i32 %63, i32 %64)
store i64 %65, i64* %18
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%67 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%68 = call i32 @strcmp(i8* %66, i8* %67)
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %51
%71 = load i32, i32* @stderr
%72 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 56)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %51
%75 = load i64, i64* %17
%76 = load i64, i64* %18
%77 = icmp eq i64 %75, %76
br i1 %77, label %82, label %78
78: ; preds = %74
%79 = load i32, i32* @stderr
%80 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 57)
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %74
%83 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 4
store i8 0, i8* %83
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%85 = call i64 @omp_capture_affinity(i8* %84, i32 5, i8* null)
%86 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%87 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%88 = call i32 @strcmp(i8* %86, i8* %87)
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %82
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 61)
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %82
%95 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%96 = load i8*, i8** %10
%97 = call i64 @omp_capture_affinity(i8* %95, i32 512, i8* %96)
store i64 %97, i64* %17
%98 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%99 = load i32, i32* %13
%100 = load i32, i32* %14
%101 = load i32, i32* %15
%102 = load i32, i32* %16
%103 = call i64 @snprintf(i8* %98, i32 512, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.10, i64 0, i64 0), i32 %99, i32 %100, i32 %101, i32 %102)
store i64 %103, i64* %18
%104 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%105 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%106 = call i32 @strcmp(i8* %104, i8* %105)
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %112
108: ; preds = %94
%109 = load i32, i32* @stderr
%110 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 65)
%111 = call i32 @exit(i32 1)
unreachable
112: ; preds = %94
%113 = load i64, i64* %17
%114 = load i64, i64* %18
%115 = icmp eq i64 %113, %114
br i1 %115, label %120, label %116
116: ; preds = %112
%117 = load i32, i32* @stderr
%118 = call i32 @fprintf(i32 %117, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 66)
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %112
%121 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 25
store i8 0, i8* %121
%122 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%123 = load i8*, i8** %10
%124 = call i64 @omp_capture_affinity(i8* %122, i32 26, i8* %123)
%125 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%126 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%127 = call i32 @strcmp(i8* %125, i8* %126)
%128 = icmp ne i32 %127, 0
br i1 %128, label %129, label %133
129: ; preds = %120
%130 = load i32, i32* @stderr
%131 = call i32 @fprintf(i32 %130, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 71)
%132 = call i32 @exit(i32 1)
unreachable
133: ; preds = %120
%134 = call i32 @omp_display_affinity(i8* null)
%135 = load i8*, i8** %10
%136 = call i32 @omp_display_affinity(i8* %135)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"tl:%L tn:%n nt:%N an:%a\00"
@.str.1 = [114 x i8] c"nesting_level:%{nesting_level} thread_num:%{thread_num} num_threads:%{num_threads} ancestor_tnum:%{ancestor_tnum}\00"
@stderr = global i32 0
@.str.2 = [39 x i8] c"error: %s: %d: (!strcmp(buf, format))\0A\00"
@.str.3 = [259 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/bb-clusters/Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/openmp/runtime/test/affinity/format/api2.c\00"
@.str.4 = [33 x i8] c"error: %s: %d: needed == length\0A\00"
@.str.5 = [5 x i8] c"tl:%\00"
@.str.6 = [39 x i8] c"error: %s: %d: (!strcmp(buf, \22tl:%\22))\0A\00"
@.str.7 = [24 x i8] c"tl:%d tn:%d nt:%d an:%d\00"
@.str.8 = [44 x i8] c"error: %s: %d: (!strcmp(my_buf, supposed))\0A\00"
@.str.9 = [34 x i8] c"error: %s: %d: needed == needed2\0A\00"
@.str.10 = [63 x i8] c"nesting_level:%d thread_num:%d num_threads:%d ancestor_tnum:%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @omp_set_affinity_format(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = call i64 @omp_get_affinity_format(i8* %6, i32 1024)
%9 = call i32 @bcmp(i8* dereferenceable(24) %6, i8* dereferenceable(24) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i64 24)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 37)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = icmp eq i64 %8, 23
br i1 %16, label %21, label %17
17: ; preds = %15
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 38)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %15
%22 = call i64 @omp_get_affinity_format(i8* %6, i32 5)
%23 = call i32 @bcmp(i8* dereferenceable(5) %6, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 5)
%24 = icmp eq i32 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 42)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %21
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%32 = call i32 (...) @omp_get_level()
%33 = call i32 (...) @omp_get_thread_num()
%34 = call i32 (...) @omp_get_num_threads()
%35 = call i32 (...) @omp_get_level()
%36 = add nsw i32 %35, -1
%37 = call i32 @omp_get_ancestor_thread_num(i32 %36)
%38 = call i64 @omp_capture_affinity(i8* %30, i32 512, i8* null)
%39 = call i64 @snprintf(i8* %31, i32 512, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %32, i32 %33, i32 %34, i32 %37)
%40 = call i32 @strcmp(i8* %30, i8* %31)
%41 = icmp eq i32 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %29
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 56)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %29
%47 = icmp eq i64 %38, %39
br i1 %47, label %52, label %48
48: ; preds = %46
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 57)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %46
%53 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 4
store i8 0, i8* %53
%54 = call i64 @omp_capture_affinity(i8* %30, i32 5, i8* null)
%55 = call i32 @strcmp(i8* %30, i8* %31)
%56 = icmp eq i32 %55, 0
br i1 %56, label %61, label %57
57: ; preds = %52
%58 = load i32, i32* @stderr
%59 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 61)
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %52
%62 = call i64 @omp_capture_affinity(i8* %30, i32 512, i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.1, i64 0, i64 0))
%63 = call i64 @snprintf(i8* %31, i32 512, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.10, i64 0, i64 0), i32 %32, i32 %33, i32 %34, i32 %37)
%64 = call i32 @strcmp(i8* %30, i8* %31)
%65 = icmp eq i32 %64, 0
br i1 %65, label %70, label %66
66: ; preds = %61
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 65)
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %61
%71 = icmp eq i64 %62, %63
br i1 %71, label %76, label %72
72: ; preds = %70
%73 = load i32, i32* @stderr
%74 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 66)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %70
%77 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 25
store i8 0, i8* %77
%78 = call i64 @omp_capture_affinity(i8* %30, i32 26, i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.1, i64 0, i64 0))
%79 = call i32 @strcmp(i8* %30, i8* %31)
%80 = icmp eq i32 %79, 0
br i1 %80, label %85, label %81
81: ; preds = %76
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str.3, i64 0, i64 0), i32 71)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %76
%86 = call i32 @omp_display_affinity(i8* null)
%87 = call i32 @omp_display_affinity(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}