xunge/DecIR huggingface dataset:
int pthread_setcancelstate(int p0, int *p1) {
  ;
  return 0;
}


x86 assembly (clang, -O0):
<pthread_setcancelstate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_setcancelstate>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @pthread_setcancelstate(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_setcancelstate(i32 %0, i32* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printf(char *);
void bye(void) {
  printf("1-- prepping\n");
  exit(-9);
  print("1-- That was all, folks\n");
}


x86 assembly (clang, -O0):
<bye>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffff7,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bye>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffffff7,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"1-- prepping\0A\00"
define void @bye() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -9)
unreachable
}

LLVM IR (-O2):
@str = [13 x i8] c"1-- prepping\00"
define void @bye() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -9)
unreachable
}
int f1(int t) { return (t * 4) & -4; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
and    $0xfffffffc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
lea    0x0(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @f1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
%5 = and i32 %4, -4
ret i32 %5
}

LLVM IR (-O2):
define i32 @f1(i32 %0) {
%2 = shl nsw i32 %0, 2
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ GPIODirModeSet(unsigned long, unsigned char, int);
int /*<<< orphan*/ GPIOPadConfigSet(unsigned long, unsigned char, int, int);
void GPIOPinTypeADC(unsigned long ulPort, unsigned char ucPins) {
  ;
  GPIODirModeSet(ulPort, ucPins, 0x00000000);
  GPIOPadConfigSet(ulPort, ucPins, 0x00000001, 0x00000000);
}


x86 assembly (clang, -O0):
<GPIOPinTypeADC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
movzbl -0x9(%rbp),%esi
call   1040 <GPIODirModeSet@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%edx
xor    %ecx,%ecx
movzbl -0x9(%rbp),%esi
call   1030 <GPIOPadConfigSet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPinTypeADC>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edx,%edx
call   1040 <GPIODirModeSet@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <GPIOPadConfigSet@plt>

LLVM IR (-O0):
define void @GPIOPinTypeADC(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
store i64 %0, i64* %3
store i8 %1, i8* %4
%5 = load i64, i64* %3
%6 = load i8, i8* %4
%7 = call i32 @GPIODirModeSet(i64 %5, i8 zeroext %6, i32 0)
%8 = load i64, i64* %3
%9 = load i8, i8* %4
%10 = call i32 @GPIOPadConfigSet(i64 %8, i8 zeroext %9, i32 1, i32 0)
ret void
}

LLVM IR (-O2):
define void @GPIOPinTypeADC(i64 %0, i8 zeroext %1) {
%3 = tail call i32 @GPIODirModeSet(i64 %0, i8 zeroext %1, i32 0)
%4 = tail call i32 @GPIOPadConfigSet(i64 %0, i8 zeroext %1, i32 1, i32 0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int cmp64(uint32_t *a, uint32_t *b) { return (a[0] - b[0]) | (a[1] - b[1]); }


x86 assembly (clang, -O0):
<cmp64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
mov    -0x10(%rbp),%rdx
sub    0x4(%rdx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp64>:
mov    (%rdi),%ecx
sub    (%rsi),%ecx
mov    0x4(%rdi),%eax
sub    0x4(%rsi),%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp64(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = sub nsw i32 %14, %17
%19 = or i32 %11, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @cmp64(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = sub nsw i32 %3, %4
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %1, i64 1
%9 = load i32, i32* %8
%10 = sub nsw i32 %7, %9
%11 = or i32 %10, %5
ret i32 %11
}
/* Variables and functions */
char *my_strchr(char *ch, char delim) {
  while (*ch != delim) {
    if (*ch == '\0')
      return (NULL);
    ++ch;
  }
  return (ch);
}


x86 assembly (clang, -O0):
<my_strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     114f <my_strchr+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113e <my_strchr+0x3e>
movq   $0x0,-0x8(%rbp)
jmp    1157 <my_strchr+0x57>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <my_strchr+0xe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strchr>:
mov    %rdi,%rax
mov    (%rdi),%cl
cmp    %sil,%cl
je     1121 <my_strchr+0x21>
nopw   0x0(%rax,%rax,1)
test   %cl,%cl
je     1122 <my_strchr+0x22>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
cmp    %sil,%cl
jne    1110 <my_strchr+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @my_strchr(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
br label %6
6: ; preds = %19, %2
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %9, %11
br i1 %12, label %13, label %22
13: ; preds = %6
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i8* null, i8** %3
br label %24
19: ; preds = %13
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
br label %6
22: ; preds = %6
%23 = load i8*, i8** %4
store i8* %23, i8** %3
br label %24
24: ; preds = %22, %18
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
define i8* @my_strchr(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
br i1 %4, label %13, label %5
5: ; preds = %2, %9
%6 = phi i8 [ %11, %9 ], [ %3, %2 ]
%7 = phi i8* [ %10, %9 ], [ %0, %2 ]
%8 = icmp eq i8 %6, 0
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, %1
br i1 %12, label %13, label %5
13: ; preds = %5, %9, %2
%14 = phi i8* [ %0, %2 ], [ %10, %9 ], [ null, %5 ]
ret i8* %14
}
void PECIIntEnable(unsigned long ulBase, unsigned long ulIntFlags,
                   unsigned long ulIntMode) {
  unsigned long ulTemp;
  ;
  ulTemp = (*((volatile unsigned long *)(ulBase + 0x00000080)));
  ulTemp &= ~ulIntFlags;
  ulTemp |= (0x0000FFFF & ulIntFlags);
  ulTemp |= (0xFFFF0000 & ulIntMode);
  (*((volatile unsigned long *)(ulBase + 0x00000080))) = ulTemp;
}


x86 assembly (clang, -O0):
<PECIIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x80(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
and    $0xffff,%rax
or     -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
movabs $0xffff0000,%rax
and    -0x18(%rbp),%rax
or     -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x80(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PECIIntEnable>:
movzwl %si,%eax
not    %rsi
and    0x80(%rdi),%rsi
and    $0xffff0000,%edx
or     %rax,%rdx
or     %rsi,%rdx
mov    %rdx,0x80(%rdi)
ret

LLVM IR (-O0):
define void @PECIIntEnable(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = add i64 %8, 128
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
store i64 %11, i64* %7
%12 = load i64, i64* %5
%13 = xor i64 %12, -1
%14 = load i64, i64* %7
%15 = and i64 %14, %13
store i64 %15, i64* %7
%16 = load i64, i64* %5
%17 = and i64 65535, %16
%18 = load i64, i64* %7
%19 = or i64 %18, %17
store i64 %19, i64* %7
%20 = load i64, i64* %6
%21 = and i64 4294901760, %20
%22 = load i64, i64* %7
%23 = or i64 %22, %21
store i64 %23, i64* %7
%24 = load i64, i64* %7
%25 = load i64, i64* %4
%26 = add i64 %25, 128
%27 = inttoptr i64 %26 to i64*
store volatile i64 %24, i64* %27
ret void
}

LLVM IR (-O2):
define void @PECIIntEnable(i64 %0, i64 %1, i64 %2) {
%4 = add i64 %0, 128
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = xor i64 %1, -1
%8 = and i64 %6, %7
%9 = and i64 %1, 65535
%10 = and i64 %2, 4294901760
%11 = or i64 %10, %9
%12 = or i64 %11, %8
store volatile i64 %12, i64* %5
ret void
}
int cairo_code_draw_envInLabel_get_width() { return 59; }


x86 assembly (clang, -O0):
<cairo_code_draw_envInLabel_get_width>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3b,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cairo_code_draw_envInLabel_get_width>:
mov    $0x3b,%eax
ret

LLVM IR (-O0):
define i32 @cairo_code_draw_envInLabel_get_width() {
ret i32 59
}

LLVM IR (-O2):
define i32 @cairo_code_draw_envInLabel_get_width() {
ret i32 59
}
void cam_glint_attach(int lam, void (*isr)(void)) {}


x86 assembly (clang, -O0):
<cam_glint_attach>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cam_glint_attach>:
ret

LLVM IR (-O0):
define void @cam_glint_attach(i32 %0, void ()* %1) {
%3 = alloca i32
%4 = alloca void ()*
store i32 %0, i32* %3
store void ()* %1, void ()** %4
ret void
}

LLVM IR (-O2):
define void @cam_glint_attach(i32 %0, void ()* nocapture %1) {
ret void
}
int foo(int a) {
  int b;
  int c;
  int d;
  if (a == 2)
    b = 3;
  else
    b = 5;
  c = 7;
  d = 11;
  for (;;) {
    if (d == 5)
      break;
    d = b;
  }
  return 13;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    111d <foo+0x1d>
movl   $0x3,-0x8(%rbp)
jmp    1124 <foo+0x24>
movl   $0x5,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
movl   $0xb,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jne    1141 <foo+0x41>
jmp    114c <foo+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <foo+0x32>
mov    $0xd,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x2,%edi
je     1100 <foo>
mov    $0xd,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 3, i32* %3
br label %10
9: ; preds = %1
store i32 5, i32* %3
br label %10
10: ; preds = %9, %8
store i32 7, i32* %4
store i32 11, i32* %5
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 5
br i1 %13, label %14, label %15
14: ; preds = %11
br label %17
15: ; preds = %11
%16 = load i32, i32* %3
store i32 %16, i32* %5
br label %11
17: ; preds = %14
ret i32 13
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp eq i32 %0, 2
br label %3
3: ; preds = %3, %1
br i1 %2, label %3, label %4
4: ; preds = %3
ret i32 13
}
/* Variables and functions */
int /*<<< orphan*/ CTEST_ERR(char *, char const *, int);
void assert_true(int real, const char *caller, int line) {
  if ((real) == 0) {
    CTEST_ERR("%s:%d  should be true", caller, line);
  }
}


x86 assembly (clang, -O0):
<assert_true>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113f <assert_true+0x2f>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xec6(%rip),%rdi
call   1030 <CTEST_ERR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_true>:
test   %edi,%edi
je     1115 <assert_true+0x5>
ret
lea    0xee4(%rip),%rdi
jmp    1030 <CTEST_ERR@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%s:%d should be true\00"
define void @assert_true(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @CTEST_ERR(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
br label %13
13: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s:%d should be true\00"
define void @assert_true(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @CTEST_ERR(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int repeat_test_utility(int);
int stress_test(void) {
  int errors = repeat_test_utility(100);
  return errors;
}


x86 assembly (clang, -O0):
<stress_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1030 <repeat_test_utility@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_test>:
mov    $0x64,%edi
jmp    1030 <repeat_test_utility@plt>

LLVM IR (-O0):
define i32 @stress_test() {
%1 = alloca i32
%2 = call i32 @repeat_test_utility(i32 100)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @stress_test() {
%1 = tail call i32 @repeat_test_utility(i32 100)
ret i32 %1
}
unsigned bitScan_fun_long(long x) {
  unsigned r = 0;
  long s = (x & 0x8000000000l);
  if (x == 0)
    return 39;
  while (((x <<= 1) & 0x8000000000l) == s)
    ++r;
  return r;
}


x86 assembly (clang, -O0):
<bitScan_fun_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movabs $0x8000000000,%rax
and    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <bitScan_fun_long+0x38>
movl   $0x27,-0x4(%rbp)
jmp    1174 <bitScan_fun_long+0x74>
jmp    113d <bitScan_fun_long+0x3d>
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x10(%rbp)
movabs $0x8000000000,%rcx
and    %rcx,%rax
cmp    -0x20(%rbp),%rax
jne    116e <bitScan_fun_long+0x6e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <bitScan_fun_long+0x3d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitScan_fun_long>:
test   %rdi,%rdi
je     1124 <bitScan_fun_long+0x24>
mov    $0xffffffff,%eax
mov    %rdi,%rcx
nopl   (%rax)
add    %rcx,%rcx
mov    %rcx,%rdx
xor    %rdi,%rdx
add    $0x1,%eax
bt     $0x27,%rdx
jae    1110 <bitScan_fun_long+0x10>
ret
mov    $0x27,%eax
ret

LLVM IR (-O0):
define i32 @bitScan_fun_long(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
store i64 %0, i64* %3
store i32 0, i32* %4
%6 = load i64, i64* %3
%7 = and i64 %6, 549755813888
store i64 %7, i64* %5
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 39, i32* %2
br label %23
11: ; preds = %1
br label %12
12: ; preds = %18, %11
%13 = load i64, i64* %3
%14 = shl i64 %13, 1
store i64 %14, i64* %3
%15 = and i64 %14, 549755813888
%16 = load i64, i64* %5
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add i32 %19, 1
store i32 %20, i32* %4
br label %12
21: ; preds = %12
%22 = load i32, i32* %4
store i32 %22, i32* %2
br label %23
23: ; preds = %21, %10
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @bitScan_fun_long(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %10, %3 ], [ 0, %1 ]
%6 = shl i64 %4, 1
%7 = xor i64 %6, %0
%8 = and i64 %7, 549755813888
%9 = icmp eq i64 %8, 0
%10 = add i32 %5, 1
br i1 %9, label %3, label %11
11: ; preds = %3, %1
%12 = phi i32 [ 39, %1 ], [ %5, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void __gnat_free(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<__gnat_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gnat_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @__gnat_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @__gnat_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int main(void) {
  volatile int i = 0;
  i = 1;
  i = 2;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movl   $0x0,-0x4(%rsp)
movl   $0x1,-0x4(%rsp)
movl   $0x2,-0x4(%rsp)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store volatile i32 0, i32* %2
store volatile i32 1, i32* %2
store volatile i32 2, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
store volatile i32 1, i32* %1
store volatile i32 2, i32* %1
ret i32 0
}
void __svgalib_rendition_outatt(int index, int val) {}


x86 assembly (clang, -O0):
<__svgalib_rendition_outatt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__svgalib_rendition_outatt>:
ret

LLVM IR (-O0):
define void @__svgalib_rendition_outatt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @__svgalib_rendition_outatt(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ helper(struct TreeNode *, int *);
int diameterOfBinaryTree(struct TreeNode *root) {
  int ret = 0;
  helper(root, &ret);
  return ret;
}


x86 assembly (clang, -O0):
<diameterOfBinaryTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <helper@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diameterOfBinaryTree>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <helper@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define i32 @diameterOfBinaryTree(%struct.TreeNode* %0) {
%2 = alloca %struct.TreeNode*
%3 = alloca i32
store %struct.TreeNode* %0, %struct.TreeNode** %2
store i32 0, i32* %3
%4 = load %struct.TreeNode*, %struct.TreeNode** %2
%5 = call i32 @helper(%struct.TreeNode* %4, i32* %3)
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @diameterOfBinaryTree(%struct.TreeNode* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @helper(%struct.TreeNode* %0, i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ompc_init(int, char **);
int /*<<< orphan*/ ompc_main(int, char **);
int /*<<< orphan*/ ompc_terminate(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  ompc_init(argc, argv);
  ompc_terminate(ompc_main(argc, argv));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <ompc_init@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ompc_main@plt>
mov    %eax,%edi
call   1040 <ompc_terminate@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1050 <ompc_init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <ompc_main@plt>
mov    %eax,%edi
call   1040 <ompc_terminate@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @ompc_init(i32 %6, i8** %7)
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @ompc_main(i32 %9, i8** %10)
%12 = call i32 @ompc_terminate(i32 %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @ompc_init(i32 %0, i8** %1)
%4 = tail call i32 @ompc_main(i32 %0, i8** %1)
%5 = tail call i32 @ompc_terminate(i32 %4)
ret i32 0
}
int fn12(a)
char *a;
{ return sizeof a; }


x86 assembly (clang, -O0):
<fn12>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn12>:
mov    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @fn12(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i32 8
}

LLVM IR (-O2):
define i32 @fn12(i8* nocapture readnone %0) {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isprint(int);
void t_isprint_0x72() {
  Assert_real((isprint(114)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isprint.c",
              575, ("isprint should be 1 for r"));
}


x86 assembly (clang, -O0):
<t_isprint_0x72>:
push   %rbp
mov    %rsp,%rbp
mov    $0x72,%edi
call   1030 <isprint@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x23f,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isprint_0x72>:
push   %rax
mov    $0x72,%edi
call   1030 <isprint@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x23f,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for r\00"
define void @t_isprint_0x72() {
%1 = call i32 @isprint(i32 114)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 575, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [26 x i8] c"isprint should be 1 for r\00"
define void @t_isprint_0x72() {
%1 = tail call i32 @isprint(i32 114)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 575, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int MPI_Irecv(void *buf, int count, int datatype, int source, int tag, int comm,
              int *request) {
  printf("MPI Stub WARNING: Should not recv message from self\n");
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Irecv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPI_Irecv>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"MPI Stub WARNING: Should not recv message from self\0A\00"
define i32 @MPI_Irecv(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32* %6, i32** %14
%15 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [52 x i8] c"MPI Stub WARNING: Should not recv message from self\00"
define i32 @MPI_Irecv(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32* nocapture readnone %6) {
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ calculadorad_1(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char *host;
  if (argc < 2) {
    printf("usage: %s server_host\n", argv[0]);
    exit(1);
  }
  host = argv[1];
  calculadorad_1(host);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <calculadorad_1@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     114f <main+0x1f>
mov    (%rsi),%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    0x8(%rsi),%rdi
call   1050 <calculadorad_1@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"usage: %s server_host\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = call i32 @calculadorad_1(i8* %19)
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"usage: %s server_host\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @calculadorad_1(i8* %10)
%12 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
float __ocml_len4_f32(float, float, float, float);
float norm4df(float x, float y, float z, float w) {
  return __ocml_len4_f32(x, y, z, w);
}


x86 assembly (clang, -O0):
<norm4df>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1030 <__ocml_len4_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm4df>:
jmp    1030 <__ocml_len4_f32@plt>

LLVM IR (-O0):
define float @norm4df(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %6
%11 = load float, float* %7
%12 = load float, float* %8
%13 = call float @__ocml_len4_f32(float %9, float %10, float %11, float %12)
ret float %13
}

LLVM IR (-O2):
define float @norm4df(float %0, float %1, float %2, float %3) {
%5 = tail call float @__ocml_len4_f32(float %0, float %1, float %2, float %3)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
gid_t getegid(void) { return 0; }


x86 assembly (clang, -O0):
<getegid>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getegid>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @getegid() {
ret i32 0
}

LLVM IR (-O2):
define i32 @getegid() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ALchorusState_Delete(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<ALchorusState_Delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ALchorusState_Delete>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @ALchorusState_Delete(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @ALchorusState_Delete(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_break();
int /*<<< orphan*/ write_line(char *);
void latex_enumerate_item(void) {
  write_break();
  write_line("\\item");
}


x86 assembly (clang, -O0):
<latex_enumerate_item>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <write_break@plt>
lea    0xece(%rip),%rdi
call   1040 <write_line@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<latex_enumerate_item>:
push   %rax
xor    %eax,%eax
call   1030 <write_break@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <write_line@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\\item\00"
define void @latex_enumerate_item() {
%1 = call i32 (...) @write_break()
%2 = call i32 @write_line(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\\item\00"
define void @latex_enumerate_item() {
%1 = tail call i32 (...) @write_break()
%2 = tail call i32 @write_line(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void exibirMenuArvore() {
  printf("Digite o numero da opcao que deseja\n");
  printf("1 Inserir\n2 Exibir em ordem\n3 Remove\n0 Voltar\n\n");
}


x86 assembly (clang, -O0):
<exibirMenuArvore>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<exibirMenuArvore>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Digite o numero da opcao que deseja\0A\00"
@.str.1 = [48 x i8] c"1 Inserir\0A2 Exibir em ordem\0A3 Remove\0A0 Voltar\0A\0A\00"
define void @exibirMenuArvore() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Digite o numero da opcao que deseja\00"
@str.2 = [47 x i8] c"1 Inserir\0A2 Exibir em ordem\0A3 Remove\0A0 Voltar\0A\00"
define void @exibirMenuArvore() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.2, i64 0, i64 0))
ret void
}
void g_timer_stop() {}


x86 assembly (clang, -O0):
<g_timer_stop>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_timer_stop>:
ret

LLVM IR (-O0):
define void @g_timer_stop() {
ret void
}

LLVM IR (-O2):
define void @g_timer_stop() {
ret void
}
unsigned long asm_ror(unsigned long x, unsigned long r) {
  asm("rorq   %%cl, %0" : "=r"(x) : "0"(x), "c"(r));
  return x;
}


x86 assembly (clang, -O0):
<asm_ror>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
ror    %cl,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_ror>:
mov    %rsi,%rcx
mov    %rdi,%rax
ror    %cl,%rax
ret

LLVM IR (-O0):
define i64 @asm_ror(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i64 asm "rorq %cl, $0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i64 %5, i64 %6)
store i64 %7, i64* %3
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @asm_ror(i64 %0, i64 %1) {
%3 = tail call i64 asm "rorq %cl, $0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float r;
  printf("Please enter a radius of Circle : ");
  scanf("%f", &r);
  printf("The area of Circle with a radius you enter is : %f", 3.1422 * r * r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf25(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeae(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
lea    0xeca(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Please enter a radius of Circle : \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [51 x i8] c"The area of Circle with a radius you enter is : %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fmul double 3.142200e+00, %6
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = fmul double %7, %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Please enter a radius of Circle : \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [51 x i8] c"The area of Circle with a radius you enter is : %f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fmul double %6, 3.142200e+00
%8 = fmul double %7, %6
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}
/* Variables and functions */
char *dynamicLibraryAFunction();
char *dynamicLibraryBFunction();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("From dynamic library A '%s'\n", dynamicLibraryAFunction());
  printf("From dynamic library B '%s'\n", dynamicLibraryBFunction());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <dynamicLibraryAFunction@plt>
mov    %rax,%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <dynamicLibraryBFunction@plt>
mov    %rax,%rsi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <dynamicLibraryAFunction@plt>
lea    0xec1(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <dynamicLibraryBFunction@plt>
lea    0xec8(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"From dynamic library A '%s'\0A\00"
@.str.1 = [29 x i8] c"From dynamic library B '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i8* (...) @dynamicLibraryAFunction()
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* (...) @dynamicLibraryBFunction()
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"From dynamic library A '%s'\0A\00"
@.str.1 = [29 x i8] c"From dynamic library B '%s'\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @dynamicLibraryAFunction()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i8* (...) @dynamicLibraryBFunction()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}
void mdp4_lcdc_base_swap(int cndx, struct mdp4_overlay_pipe *pipe) {}


x86 assembly (clang, -O0):
<mdp4_lcdc_base_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdp4_lcdc_base_swap>:
ret

LLVM IR (-O0):
%struct.mdp4_overlay_pipe = type opaque
define void @mdp4_lcdc_base_swap(i32 %0, %struct.mdp4_overlay_pipe* %1) {
%3 = alloca i32
%4 = alloca %struct.mdp4_overlay_pipe*
store i32 %0, i32* %3
store %struct.mdp4_overlay_pipe* %1, %struct.mdp4_overlay_pipe** %4
ret void
}

LLVM IR (-O2):
%struct.mdp4_overlay_pipe = type opaque
define void @mdp4_lcdc_base_swap(i32 %0, %struct.mdp4_overlay_pipe* nocapture %1) {
ret void
}
/* Type definitions */
typedef int pthread_t;
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int thread_create(void *(*)(void *), void *, int);
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
                   void *(*startRoutine)(void *), void *args) {
  pthread_t id;
  id = thread_create(startRoutine, args, 0x10000);
  if (thread) {
    *thread = id;
  }
  return id;
}


x86 assembly (clang, -O0):
<pthread_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10000,%edx
call   1030 <thread_create@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1151 <pthread_create+0x41>
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_create>:
push   %rbx
mov    %rdi,%rbx
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    $0x10000,%edx
call   1030 <thread_create@plt>
test   %rbx,%rbx
je     112b <pthread_create+0x1b>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8* (i8*)*
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* (i8*)* %2, i8* (i8*)** %7
store i8* %3, i8** %8
%10 = load i8* (i8*)*, i8* (i8*)** %7
%11 = load i8*, i8** %8
%12 = call i32 @thread_create(i8* (i8*)* %10, i8* %11, i32 65536)
store i32 %12, i32* %9
%13 = load i32*, i32** %5
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32, i32* %9
%17 = load i32*, i32** %5
store i32 %16, i32* %17
br label %18
18: ; preds = %15, %4
%19 = load i32, i32* %9
ret i32 %19
}

LLVM IR (-O2):
define i32 @pthread_create(i32* writeonly %0, i32* nocapture readnone %1, i8* (i8*)* %2, i8* %3) {
%5 = tail call i32 @thread_create(i8* (i8*)* %2, i8* %3, i32 65536)
%6 = icmp eq i32* %0, null
br i1 %6, label %8, label %7
7: ; preds = %4
store i32 %5, i32* %0
br label %8
8: ; preds = %7, %4
ret i32 %5
}
unsigned nearest_pow2(const unsigned n) {
  unsigned r, p;
  if (n < 2)
    return n;
  for (r = 1, p = 0; r != 0; r <<= 1, p++)
    if (r >= n)
      break;
  return p;
}


x86 assembly (clang, -O0):
<nearest_pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jae    111c <nearest_pow2+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <nearest_pow2+0x67>
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1161 <nearest_pow2+0x61>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jb     1145 <nearest_pow2+0x45>
jmp    1161 <nearest_pow2+0x61>
jmp    114a <nearest_pow2+0x4a>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <nearest_pow2+0x2a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nearest_pow2>:
cmp    $0x2,%edi
jae    1108 <nearest_pow2+0x8>
mov    %edi,%eax
ret
mov    $0x1,%ecx
xor    %eax,%eax
nop
add    %ecx,%ecx
add    $0x1,%eax
test   %ecx,%ecx
je     111d <nearest_pow2+0x1d>
cmp    %edi,%ecx
jb     1110 <nearest_pow2+0x10>
ret

LLVM IR (-O0):
define i32 @nearest_pow2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp ult i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %3
store i32 %9, i32* %2
br label %27
10: ; preds = %1
store i32 1, i32* %4
store i32 0, i32* %5
br label %11
11: ; preds = %20, %10
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp uge i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %14
br label %25
19: ; preds = %14
br label %20
20: ; preds = %19
%21 = load i32, i32* %4
%22 = shl i32 %21, 1
store i32 %22, i32* %4
%23 = load i32, i32* %5
%24 = add i32 %23, 1
store i32 %24, i32* %5
br label %11
25: ; preds = %18, %11
%26 = load i32, i32* %5
store i32 %26, i32* %2
br label %27
27: ; preds = %25, %8
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @nearest_pow2(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ 1, %1 ]
%6 = shl i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ne i32 %6, 0
%9 = icmp ult i32 %6, %0
%10 = and i1 %8, %9
br i1 %10, label %3, label %11
11: ; preds = %3, %1
%12 = phi i32 [ %0, %1 ], [ %7, %3 ]
ret i32 %12
}
int bar(char p1, char p2) { return &p1 == &p2; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    -0x1(%rbp),%rax
lea    -0x2(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bar(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = icmp eq i8* %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @bar(i8 signext %0, i8 signext %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int version(void) {
  printf("kppd version %s\n", "1.1.0");
  printf("Copyright (c) 2015 savoca <savoca@codefi.re>\n");
  return 0;
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeef(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xee2(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"kppd version %s\0A\00"
@.str.1 = [6 x i8] c"1.1.0\00"
@.str.2 = [46 x i8] c"Copyright (c) 2015 savoca <savoca@codefi.re>\0A\00"
define i32 @version() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"kppd version %s\0A\00"
@.str.1 = [6 x i8] c"1.1.0\00"
@str = [45 x i8] c"Copyright (c) 2015 savoca <savoca@codefi.re>\00"
define i32 @version() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int cache_close_data(void) { return -1; }


x86 assembly (clang, -O0):
<cache_close_data>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cache_close_data>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @cache_close_data() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @cache_close_data() {
ret i32 -1
}
/* Variables and functions */
int INT_MIN;
int /*<<< orphan*/ abort();
__attribute__((no)) void foo(int a) {
  int b = (a - 1) + INT_MIN;
  if (b != INT_MIN)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    0x2ec0(%rip),%rcx
add    (%rcx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2eb1(%rip),%rcx
cmp    (%rcx),%eax
je     1146 <foo+0x36>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x1,%edi
jne    1116 <foo+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@INT_MIN = global i32 0
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 1
%6 = load i32, i32* @INT_MIN
%7 = add nsw i32 %5, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* @INT_MIN
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %1
ret void
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define void @foo(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
void menuSelect(int value) {}


x86 assembly (clang, -O0):
<menuSelect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuSelect>:
ret

LLVM IR (-O0):
define void @menuSelect(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @menuSelect(i32 %0) {
ret void
}