xunge/DecIR huggingface dataset:
int bitXor(int x, int y) { return ~(~(x & ~y) & ~(~x & y)); }


x86 assembly (clang, -O0):
<bitXor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
xor    $0xffffffff,%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
and    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitXor>:
mov    %edi,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @bitXor(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 = load i32, i32* %4
%7 = xor i32 %6, -1
%8 = and i32 %5, %7
%9 = xor i32 %8, -1
%10 = load i32, i32* %3
%11 = xor i32 %10, -1
%12 = load i32, i32* %4
%13 = and i32 %11, %12
%14 = xor i32 %13, -1
%15 = and i32 %9, %14
%16 = xor i32 %15, -1
ret i32 %16
}

LLVM IR (-O2):
define i32 @bitXor(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int _check_array_size(int size) {
  if (size < 0) {
    printf("Invalid array size: %d\n", size);
    exit(-3);
  } else
    return size;
}


x86 assembly (clang, -O0):
<_check_array_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114e <_check_array_size+0x2e>
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    $0xfffffffd,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_array_size>:
mov    %edi,%eax
test   %edi,%edi
js     1127 <_check_array_size+0x7>
ret
push   %rax
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xfffffffd,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Invalid array size: %d\0A\00"
define i32 @_check_array_size(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @exit(i32 -3)
unreachable
9: ; preds = %1
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [24 x i8] c"Invalid array size: %d\0A\00"
define i32 @_check_array_size(i32 returned %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 @exit(i32 -3)
unreachable
6: ; preds = %1
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rob(int *, int);
int main(void) {
  int x[] = {8, 2, 8, 9, 2};
  printf("%d\n", rob(x, sizeof(x) / sizeof(x[0])));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <rob@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <rob@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [5 x i32] [i32 8, i32 2, i32 8, i32 9, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = bitcast [5 x i32]* %2 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%5 = call i32 @rob(i32* %4, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [5 x i32] [i32 8, i32 2, i32 8, i32 9, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @rob(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void list(void) {
  printf("Please choose an option: (0) Sine (1) Cosine (2) Tangent (3) QUIT\n");
  printf("Enter your choice: ");
}


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

x86 assembly (clang, -O2):
<list>:
push   %rax
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [67 x i8] c"Please choose an option: (0) Sine (1) Cosine (2) Tangent (3) QUIT\0A\00"
@.str.1 = [20 x i8] c"Enter your choice: \00"
define void @list() {
%1 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"Enter your choice: \00"
@str = [66 x i8] c"Please choose an option: (0) Sine (1) Cosine (2) Tangent (3) QUIT\00"
define void @list() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}
char *index(s, c)
register char *s;
char c;
{
  while (*s) {
    if (*s == c)
      return s;
    s++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<index>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114c <index+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    113b <index+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <index+0x54>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <index+0xe>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @index(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
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, %1
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, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %9, %2
%14 = phi i8* [ null, %2 ], [ null, %9 ], [ %7, %5 ]
ret i8* %14
}
/* Variables and functions */
int nread(char *, unsigned int, unsigned int);
int read_msg(char *buf, unsigned int maxlen) {
  unsigned int len;
  if (nread(buf, 2, maxlen) != 2) {
    return -1;
  }
  len = (buf[0] << 8) | buf[1];
  return nread(buf, len, maxlen);
}


x86 assembly (clang, -O0):
<read_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x2,%esi
call   1030 <nread@plt>
cmp    $0x2,%eax
je     1145 <read_msg+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <read_msg+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <nread@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_msg>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x2,%esi
mov    %ebp,%edx
call   1030 <nread@plt>
cmp    $0x2,%eax
jne    1145 <read_msg+0x35>
movsbl (%rbx),%eax
shl    $0x8,%eax
movsbl 0x1(%rbx),%esi
or     %eax,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <nread@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @read_msg(i8* %0, i32 %1) {
%3 = tail call i32 @nread(i8* %0, i32 2, i32 %1)
%4 = icmp eq i32 %3, 2
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = load i8, i8* %0
%7 = sext i8 %6 to i32
%8 = shl nsw i32 %7, 8
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = or i32 %8, %11
%13 = tail call i32 @nread(i8* %0, i32 %12, i32 %1)
br label %14
14: ; preds = %2, %5
%15 = phi i32 [ %13, %5 ], [ -1, %2 ]
ret i32 %15
}
void SysCtlReleaseSubSystemFromReset(unsigned long ulResetConf) {
  unsigned long ulMWRAllow;
  ulMWRAllow = (*((volatile unsigned long *)(0x400FB980)));
  (*((volatile unsigned long *)(0x400FB980))) = 0xA5A5A5A5;
  (*((volatile unsigned long *)(0x400FB8C0))) |=
      ((ulResetConf & 0x00000003) << 16);
  (*((volatile unsigned long *)(0x400FB980))) = ulMWRAllow;
}


x86 assembly (clang, -O0):
<SysCtlReleaseSubSystemFromReset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x400fb980,%eax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    $0x400fb980,%eax
mov    $0xa5a5a5a5,%ecx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
and    $0x3,%rax
shl    $0x10,%rax
mov    $0x400fb8c0,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb8c0,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    $0x400fb980,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlReleaseSubSystemFromReset>:
mov    0x400fb980,%rax
40
mov    $0xa5a5a5a5,%ecx
mov    %rcx,0x400fb980
40
and    $0x3,%edi
shl    $0x10,%rdi
or     %rdi,0x400fb8c0
40
mov    %rax,0x400fb980
40
ret

LLVM IR (-O0):
define void @SysCtlReleaseSubSystemFromReset(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store i64 %4, i64* %3
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
%5 = load i64, i64* %2
%6 = and i64 %5, 3
%7 = shl i64 %6, 16
%8 = load volatile i64, i64* inttoptr (i64 1074772160 to i64*)
%9 = or i64 %8, %7
store volatile i64 %9, i64* inttoptr (i64 1074772160 to i64*)
%10 = load i64, i64* %3
store volatile i64 %10, i64* inttoptr (i64 1074772352 to i64*)
ret void
}

LLVM IR (-O2):
define void @SysCtlReleaseSubSystemFromReset(i64 %0) {
%2 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
%3 = shl i64 %0, 16
%4 = and i64 %3, 196608
%5 = load volatile i64, i64* inttoptr (i64 1074772160 to i64*)
%6 = or i64 %5, %4
store volatile i64 %6, i64* inttoptr (i64 1074772160 to i64*)
store volatile i64 %2, i64* inttoptr (i64 1074772352 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isprint(int);
void t_isprint_0x3c() {
  Assert_real((isprint(60)),
              "/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",
              305, ("isprint should be 1 for <"));
}


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

x86 assembly (clang, -O2):
<t_isprint_0x3c>:
push   %rax
mov    $0x3c,%edi
call   1030 <isprint@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x131,%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 <\00"
define void @t_isprint_0x3c() {
%1 = call i32 @isprint(i32 60)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, 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 <\00"
define void @t_isprint_0x3c() {
%1 = tail call i32 @isprint(i32 60)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Leds__led1Toggle();
void TelosbSensorReadingC__Leds__led1Toggle(void) { LedsP__Leds__led1Toggle(); }


x86 assembly (clang, -O0):
<TelosbSensorReadingC__Leds__led1Toggle>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <LedsP__Leds__led1Toggle@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TelosbSensorReadingC__Leds__led1Toggle>:
xor    %eax,%eax
jmp    1030 <LedsP__Leds__led1Toggle@plt>

LLVM IR (-O0):
define void @TelosbSensorReadingC__Leds__led1Toggle() {
%1 = call i32 (...) @LedsP__Leds__led1Toggle()
ret void
}

LLVM IR (-O2):
define void @TelosbSensorReadingC__Leds__led1Toggle() {
%1 = tail call i32 (...) @LedsP__Leds__led1Toggle()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ number();
void constant(void) { number(); }


x86 assembly (clang, -O0):
<constant>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <number@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant>:
xor    %eax,%eax
jmp    1030 <number@plt>

LLVM IR (-O0):
define void @constant() {
%1 = call i32 (...) @number()
ret void
}

LLVM IR (-O2):
define void @constant() {
%1 = tail call i32 (...) @number()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nrf_drv_usbd_errata_type_52840_eng_b();
bool nrf_drv_usbd_errata_200(void) {
  return (1 && (!nrf_drv_usbd_errata_type_52840_eng_b()));
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <nrf_drv_usbd_errata_type_52840_eng_b@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
xor    %eax,%eax
call   1030 <nrf_drv_usbd_errata_type_52840_eng_b@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @nrf_drv_usbd_errata_200() {
%1 = call i32 (...) @nrf_drv_usbd_errata_type_52840_eng_b()
%2 = icmp ne i32 %1, 0
%3 = xor i1 %2, true
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @nrf_drv_usbd_errata_200() {
%1 = tail call i32 (...) @nrf_drv_usbd_errata_type_52840_eng_b()
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
int validateAtmCardNumber(char atmCardNumber[]) { return 2; }


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

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

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

LLVM IR (-O2):
define i32 @validateAtmCardNumber(i8* nocapture readnone %0) {
ret i32 2
}
int twoInt(const char *cp) {
  int a, b;
  a = cp[0] - '0';
  if (a < 0 || a > 9)
    return -1;
  b = cp[1] - '0';
  if (b < 0 || b > 9)
    return -1;
  return (a * 10) + b;
}


x86 assembly (clang, -O0):
<twoInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1129 <twoInt+0x29>
cmpl   $0x9,-0x14(%rbp)
jle    1135 <twoInt+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <twoInt+0x6d>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1157 <twoInt+0x57>
cmpl   $0x9,-0x18(%rbp)
jle    1163 <twoInt+0x63>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <twoInt+0x6d>
imul   $0xa,-0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<twoInt>:
movsbl (%rdi),%ecx
lea    -0x3a(%rcx),%edx
mov    $0xffffffff,%eax
cmp    $0xf6,%dl
jb     1128 <twoInt+0x28>
movzbl 0x1(%rdi),%edx
lea    -0x3a(%rdx),%esi
cmp    $0xf6,%sil
jb     1128 <twoInt+0x28>
lea    (%rcx,%rcx,4),%eax
lea    (%rdx,%rax,2),%eax
add    $0xfffffdf0,%eax
ret

LLVM IR (-O0):
define i32 @twoInt(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %1
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 9
br i1 %15, label %16, label %17
16: ; preds = %13, %1
store i32 -1, i32* %2
br label %34
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %21, 48
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %17
%26 = load i32, i32* %5
%27 = icmp sgt i32 %26, 9
br i1 %27, label %28, label %29
28: ; preds = %25, %17
store i32 -1, i32* %2
br label %34
29: ; preds = %25
%30 = load i32, i32* %4
%31 = mul nsw i32 %30, 10
%32 = load i32, i32* %5
%33 = add nsw i32 %31, %32
store i32 %33, i32* %2
br label %34
34: ; preds = %29, %28, %16
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @twoInt(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = add i8 %2, -58
%5 = icmp ult i8 %4, -10
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = add i8 %8, -58
%10 = icmp ult i8 %9, -10
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = zext i8 %8 to i32
%13 = mul nsw i32 %3, 10
%14 = add nsw i32 %13, -528
%15 = add nsw i32 %14, %12
br label %16
16: ; preds = %6, %1, %11
%17 = phi i32 [ %15, %11 ], [ -1, %1 ], [ -1, %6 ]
ret i32 %17
}
void caller_2_2_2_2_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_2_2_2_2_2_2_2() {
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
char *copyString(const char *str) {
  int str_len = strlen(str);
  char *str_copy;
  str_copy = malloc(str_len + 1);
  memcpy(str_copy, str, str_len + 1);
  return str_copy;
}


x86 assembly (clang, -O0):
<copyString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyString>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @copyString(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = call i32 @memcpy(i8* %10, i8* %11, i32 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @copyString(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
ret i8* %4
}
double expm1(double x) {
  puts("# ");
  puts(__FUNCTION__);
  puts("()\n");
  delay(100000000);
  (void)(x);
  return 0;
}


x86 assembly (clang, -O0):
<expm1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
mov    $0x0,%al
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expm1>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
xor    %eax,%eax
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.expm1 = [6 x i8] c"expm1\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @expm1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__FUNCTION__.expm1, i64 0, i64 0))
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
%7 = load double, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.expm1 = [6 x i8] c"expm1\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @expm1(double %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__FUNCTION__.expm1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
ret double 0.000000e+00
}
int good0(void) { return __builtin_constant_p(1); }


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

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

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

LLVM IR (-O2):
define i32 @good0() {
ret i32 1
}
/* Variables and functions */
char *get_bintime();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("%s\n", get_bintime());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @get_bintime()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
void c_fopen_(FILE **fp, char *path, char *mode) { *fp = fopen(path, mode); }


x86 assembly (clang, -O0):
<c_fopen_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fopen@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_fopen_>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <fopen@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @c_fopen_(i32** %0, i8* %1, i8* %2) {
%4 = alloca i32**
%5 = alloca i8*
%6 = alloca i8*
store i32** %0, i32*** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i32* @fopen(i8* %7, i8* %8)
%10 = load i32**, i32*** %4
store i32* %9, i32** %10
ret void
}

LLVM IR (-O2):
define void @c_fopen_(i32** nocapture writeonly %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i32* @fopen(i8* %1, i8* %2)
store i32* %4, i32** %0
ret void
}
/* Variables and functions */
scalar_t__ is_alpha(char);
scalar_t__ is_digit(char);
bool is_alnum(char ch) { return is_alpha(ch) || is_digit(ch); }


x86 assembly (clang, -O0):
<is_alnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <is_alnum+0x3c>
movsbl -0x1(%rbp),%edi
call   1030 <is_digit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alnum>:
push   %rbx
mov    %edi,%ebx
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <is_alnum+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <is_digit@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_alnum(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @is_alpha(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @is_digit(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_alnum(i8 signext %0) {
%2 = tail call i64 @is_alpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @is_digit(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
void rop3_3_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = T | S;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_3_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_3_1_1>:
mov    %edx,%eax
or     %sil,%al
not    %al
mov    (%rdi),%cl
and    %cl,%sil
or     %al,%sil
and    %dl,%cl
or     %sil,%cl
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_3_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = or i32 %9, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = zext i8 %14 to i32
%16 = xor i32 %15, -1
%17 = trunc i32 %16 to i8
store i8 %17, i8* %7
%18 = load i8, i8* %7
%19 = zext i8 %18 to i32
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = xor i32 %21, -1
%23 = and i32 %19, %22
%24 = load i8, i8* %6
%25 = zext i8 %24 to i32
%26 = xor i32 %25, -1
%27 = and i32 %23, %26
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = and i32 %30, %32
%34 = or i32 %27, %33
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = load i8, i8* %6
%39 = zext i8 %38 to i32
%40 = and i32 %37, %39
%41 = or i32 %34, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_3_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
%5 = xor i8 %4, -1
%6 = load i8, i8* %0
%7 = and i8 %6, %1
%8 = or i8 %7, %5
%9 = and i8 %6, %2
%10 = or i8 %8, %9
store i8 %10, i8* %0
ret void
}
void zera_string(char *alvo, int inicio, int fim) {
  int ind;
  for (ind = inicio; ind < fim; ind++)
    alvo[ind] = '\0';
}


x86 assembly (clang, -O0):
<zera_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    113a <zera_string+0x3a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1114 <zera_string+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zera_string>:
cmp    %edx,%esi
jge    1133 <zera_string+0x23>
push   %rax
mov    %esi,%eax
movslq %esi,%rcx
add    %rcx,%rdi
not    %eax
add    %edx,%eax
add    $0x1,%rax
xor    %esi,%esi
mov    %rax,%rdx
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @zera_string(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
store i32 %8, i32* %7
br label %9
9: ; preds = %18, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %13
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %9
21: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @zera_string(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = getelementptr i8, i8* %0, i64 %6
%8 = xor i32 %1, -1
%9 = add i32 %8, %2
%10 = zext i32 %9 to i64
%11 = add nuw nsw i64 %10, 1
br label %12
12: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float const, float const, float const,
                          float const);
void glmPrintVector4f(const float v[4]) {
  printf("[%f,%f,%f,%f]", v[0], v[1], v[2], v[3]);
}


x86 assembly (clang, -O0):
<glmPrintVector4f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm3
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmPrintVector4f>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
movss  0x8(%rdi),%xmm2
movss  0xc(%rdi),%xmm3
lea    0xed6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"[%f,%f,%f,%f]\00"
define void @glmPrintVector4f(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 1
%8 = load float, float* %7
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 2
%11 = load float, float* %10
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 3
%14 = load float, float* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %5, float %8, float %11, float %14)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"[%f,%f,%f,%f]\00"
define void @glmPrintVector4f(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = getelementptr inbounds float, float* %0, i64 2
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %0, i64 3
%8 = load float, float* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %2, float %4, float %6, float %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putword(unsigned short);
void twobyte(int co) { putword((unsigned short)co); }


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

x86 assembly (clang, -O2):
<twobyte>:
movzwl %di,%edi
jmp    1030 <putword@plt>

LLVM IR (-O0):
define void @twobyte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i16
%5 = call i32 @putword(i16 zeroext %4)
ret void
}

LLVM IR (-O2):
define void @twobyte(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i32 @putword(i16 zeroext %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  int titulos_da_meca = 1;
  int titulos_da_tro = 5;
  if (titulos_da_tro > titulos_da_meca) {
    puts("dale tro");
  } else {
    puts("a meca é rei");
  }
  if ('0') {
    puts("kopper lindo");
  }
  if ('\0') {
    puts("gui lindo");
  }
  if (0) {
    puts("vamo tnt");
  }
  if ((1 || 0) & (1 & 0)) {
    puts("oficio");
  } else {
    puts("força eletro");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    114a <main+0x3a>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
jmp    1156 <main+0x46>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"dale tro\00"
@.str.1 = [14 x i8] c"a meca \C3\A9 rei\00"
@.str.2 = [13 x i8] c"kopper lindo\00"
@.str.3 = [14 x i8] c"for\C3\A7a eletro\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 5, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = icmp sgt i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"dale tro\00"
@.str.2 = [13 x i8] c"kopper lindo\00"
@.str.3 = [14 x i8] c"for\C3\A7a eletro\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint16_t;
struct pcg_state_16 {
  int dummy;
};

/* Variables and functions */
int pcg_unique_16_rxs_m_xs_16_random_r(struct pcg_state_16 *);
uint16_t pcg_unique_16_rxs_m_xs_16_boundedrand_r(struct pcg_state_16 *rng,
                                                 uint16_t bound) {
  uint16_t threshold = ((uint16_t)(-bound)) % bound;
  for (;;) {
    uint16_t r = pcg_unique_16_rxs_m_xs_16_random_r(rng);
    if (r >= threshold)
      return r % bound;
  }
}


x86 assembly (clang, -O0):
<pcg_unique_16_rxs_m_xs_16_boundedrand_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pcg_unique_16_rxs_m_xs_16_random_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1152 <pcg_unique_16_rxs_m_xs_16_boundedrand_r+0x42>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    112b <pcg_unique_16_rxs_m_xs_16_boundedrand_r+0x1b>

x86 assembly (clang, -O2):
<pcg_unique_16_rxs_m_xs_16_boundedrand_r>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <pcg_unique_16_rxs_m_xs_16_random_r@plt>
test   %eax,%eax
js     1120 <pcg_unique_16_rxs_m_xs_16_boundedrand_r+0x10>
cltd
idiv   %ebp
mov    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.pcg_state_16 = type { i32 }
define i32 @pcg_unique_16_rxs_m_xs_16_boundedrand_r(%struct.pcg_state_16* %0, i32 %1) {
%3 = alloca %struct.pcg_state_16*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.pcg_state_16* %0, %struct.pcg_state_16** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sub nsw i32 0, %7
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
store i32 %10, i32* %5
br label %11
11: ; preds = %21, %2
%12 = load %struct.pcg_state_16*, %struct.pcg_state_16** %3
%13 = call i32 @pcg_unique_16_rxs_m_xs_16_random_r(%struct.pcg_state_16* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = icmp sge i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = srem i32 %18, %19
ret i32 %20
21: ; preds = %11
br label %11
}

LLVM IR (-O2):
%struct.pcg_state_16 = type { i32 }
define i32 @pcg_unique_16_rxs_m_xs_16_boundedrand_r(%struct.pcg_state_16* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @pcg_unique_16_rxs_m_xs_16_random_r(%struct.pcg_state_16* %0)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = srem i32 %4, %1
ret i32 %7
}
/* Variables and functions */
int random_integer(int const, int const);
void random_int_array(int array[], const unsigned int length, const int min,
                      const int max) {
  for (int i = 0; i < length; ++i)
    array[i] = random_integer(min, max);
}


x86 assembly (clang, -O0):
<random_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    115e <random_int_array+0x4e>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <random_integer@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <random_int_array+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
je     1148 <random_int_array+0x38>
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rdi,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r15d,%edi
mov    %r14d,%esi
call   1030 <random_integer@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <random_int_array+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @random_int_array(i32* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %9
8: ; preds = %9, %4
ret void
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %13, %9 ]
%11 = tail call i32 @random_integer(i32 %2, i32 %3)
%12 = getelementptr inbounds i32, i32* %0, i64 %10
store i32 %11, i32* %12
%13 = add nuw nsw i64 %10, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %8, label %9
}
void fbcon_fb_unbind(struct fb_info *info) {}


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

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

LLVM IR (-O0):
%struct.fb_info = type opaque
define void @fbcon_fb_unbind(%struct.fb_info* %0) {
%2 = alloca %struct.fb_info*
store %struct.fb_info* %0, %struct.fb_info** %2
ret void
}

LLVM IR (-O2):
%struct.fb_info = type opaque
define void @fbcon_fb_unbind(%struct.fb_info* nocapture %0) {
ret void
}
/* Variables and functions */
int rollDie(int, int);
int statRoll(int max) {
  int val = 0;
  while (val <= 5) {
    val = rollDie(1, max);
  }
  return val;
}


x86 assembly (clang, -O0):
<statRoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     1141 <statRoll+0x31>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <rollDie@plt>
mov    %eax,-0x8(%rbp)
jmp    1122 <statRoll+0x12>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<statRoll>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
mov    %ebx,%esi
call   1030 <rollDie@plt>
cmp    $0x6,%eax
jl     1120 <statRoll+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define i32 @statRoll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 5
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @rollDie(i32 1, i32 %8)
store i32 %9, i32* %3
br label %4
10: ; preds = %4
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @statRoll(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @rollDie(i32 1, i32 %0)
%4 = icmp slt i32 %3, 6
br i1 %4, label %2, label %5
5: ; preds = %2
ret i32 %3
}
int int_square(int x) { return (x * x); }


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

x86 assembly (clang, -O2):
<int_square>:
mov    %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @int_square(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
unsigned int opp_limit_to_floor(int limit) {
  unsigned int floor;
  if (limit >= 0)
    floor = (limit < 8 ? limit : 8 - 1);
  else
    floor = 8 - 1;
  return floor;
}


x86 assembly (clang, -O0):
<opp_limit_to_floor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     113e <opp_limit_to_floor+0x3e>
cmpl   $0x8,-0x4(%rbp)
jge    1126 <opp_limit_to_floor+0x26>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <opp_limit_to_floor+0x33>
mov    $0x7,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <opp_limit_to_floor+0x33>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <opp_limit_to_floor+0x45>
movl   $0x7,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opp_limit_to_floor>:
cmp    $0x7,%edi
mov    $0x7,%eax
cmovb  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @opp_limit_to_floor(i32 %0) {
%2 = icmp ult i32 %0, 7
%3 = select i1 %2, i32 %0, i32 7
ret i32 %3
}