xunge/DecIR huggingface dataset:
/* Variables and functions */
int capturePositiveValue();
int /*<<< orphan*/ printf(char *);
int getWidth() {
  printf(
      "\nEnter number of asterisks to prints in each row (i.e. the width): ");
  return capturePositiveValue();
}


x86 assembly (clang, -O0):
<getWidth>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <capturePositiveValue@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWidth>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <capturePositiveValue@plt>

LLVM IR (-O0):
@.str = [68 x i8] c"\0AEnter number of asterisks to prints in each row (i.e. the width): \00"
define i32 @getWidth() {
%1 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @capturePositiveValue()
ret i32 %2
}

LLVM IR (-O2):
@.str = [68 x i8] c"\0AEnter number of asterisks to prints in each row (i.e. the width): \00"
define i32 @getWidth() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @capturePositiveValue()
ret i32 %2
}
int setup_tests(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @setup_tests() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ _delay_ms(unsigned int);
void delay(unsigned int z) { _delay_ms(z); }


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

x86 assembly (clang, -O2):
<delay>:
jmp    1030 <_delay_ms@plt>

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

LLVM IR (-O2):
define void @delay(i32 %0) {
%2 = tail call i32 @_delay_ms(i32 %0)
ret void
}
int INHERENT_utimes() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @INHERENT_utimes() {
ret i32 0
}
float remainingAngle(a, b) { return 180 - a - b; }


x86 assembly (clang, -O0):
<remainingAngle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xb4,%eax
sub    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<remainingAngle>:
add    %esi,%edi
mov    $0xb4,%eax
sub    %edi,%eax
cvtsi2ss %eax,%xmm0
ret

LLVM IR (-O0):
define float @remainingAngle(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 = sub nsw i32 180, %5
%7 = load i32, i32* %4
%8 = sub nsw i32 %6, %7
%9 = sitofp i32 %8 to float
ret float %9
}

LLVM IR (-O2):
define float @remainingAngle(i32 %0, i32 %1) {
%3 = add i32 %0, %1
%4 = sub i32 180, %3
%5 = sitofp i32 %4 to float
ret float %5
}
int i2c_set_hwdata(struct i2c_client *client, struct i2c_hid_hw_data *ihid) {
  return 0;
}


x86 assembly (clang, -O0):
<i2c_set_hwdata>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.i2c_client = type opaque
%struct.i2c_hid_hw_data = type opaque
define i32 @i2c_set_hwdata(%struct.i2c_client* nocapture readnone %0, %struct.i2c_hid_hw_data* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LOCK_SH;
int /*<<< orphan*/ flock(int, int /*<<< orphan*/);
int suspend_open();
int suspend_block(int handle) {
  if (handle < 0)
    handle = suspend_open();
  if (handle < 0)
    return handle;
  flock(handle, LOCK_SH);
  return handle;
}


x86 assembly (clang, -O0):
<suspend_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    113f <suspend_block+0x1f>
mov    $0x0,%al
call   1030 <suspend_open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1154 <suspend_block+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116b <suspend_block+0x4b>
mov    -0x8(%rbp),%edi
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
call   1040 <flock@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suspend_block>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
jns    1134 <suspend_block+0x14>
xor    %eax,%eax
call   1030 <suspend_open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1144 <suspend_block+0x24>
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1040 <flock@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@LOCK_SH = global i32 0
define i32 @suspend_block(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @suspend_open()
store i32 %7, i32* %3
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* %3
store i32 %12, i32* %2
br label %18
13: ; preds = %8
%14 = load i32, i32* %3
%15 = load i32, i32* @LOCK_SH
%16 = call i32 @flock(i32 %14, i32 %15)
%17 = load i32, i32* %3
store i32 %17, i32* %2
br label %18
18: ; preds = %13, %11
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@LOCK_SH = global i32 0
define i32 @suspend_block(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 (...) @suspend_open()
%5 = icmp slt i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ %0, %1 ]
%8 = load i32, i32* @LOCK_SH
%9 = tail call i32 @flock(i32 %7, i32 %8)
br label %10
10: ; preds = %3, %6
%11 = phi i32 [ %4, %3 ], [ %7, %6 ]
ret i32 %11
}
/* Variables and functions */
double g(double *);
double test() {
  double x = 42.0;
  return g(&x);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
movabs $0x4045000000000000,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <g@plt>
pop    %rax
ret

LLVM IR (-O0):
define double @test() {
%1 = alloca double
store double 4.200000e+01, double* %1
%2 = call double @g(double* %1)
ret double %2
}

LLVM IR (-O2):
define double @test() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 4.200000e+01, double* %1
%3 = call double @g(double* %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void error(void) {
  printf("Output error\n");
  exit(1);
}


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Output error\00"
define void @error() {
%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 1)
unreachable
}
int cmp(char *s1, char *s2) {
  while (*s1 == *s2++)
    if (*s1++ == 0)
      return 0;
  return (*s1 - *(s2 - 1));
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1159 <cmp+0x59>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1154 <cmp+0x54>
movl   $0x0,-0x4(%rbp)
jmp    116d <cmp+0x6d>
jmp    110c <cmp+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl -0x1(%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rdi,%rcx,1),%eax
movsbl (%rsi,%rcx,1),%edx
cmp    %dl,%al
jne    1127 <cmp+0x27>
add    $0x1,%rcx
test   %al,%al
jne    1110 <cmp+0x10>
xor    %eax,%eax
ret
sub    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %0, %2 ], [ %11, %9 ]
%5 = phi i8* [ %1, %2 ], [ %10, %9 ]
%6 = load i8, i8* %4
%7 = load i8, i8* %5
%8 = icmp eq i8 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = getelementptr inbounds i8, i8* %4, i64 1
%12 = icmp eq i8 %6, 0
br i1 %12, label %17, label %3
13: ; preds = %3
%14 = sext i8 %6 to i32
%15 = sext i8 %7 to i32
%16 = sub nsw i32 %14, %15
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ %16, %13 ], [ 0, %9 ]
ret i32 %18
}
void GrOffScreen8BPPFlush(void *pvDisplayData) { ; }


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

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

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

LLVM IR (-O2):
define void @GrOffScreen8BPPFlush(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ msgs;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(void) {
  char *msgs[] = {"Maya Client ver 0.0.0", "    Usage: user [options]"};
  for (int i = 0; i < sizeof(msgs) / sizeof(char *); ++i) {
    printf("%s\n", msgs[i]);
  }
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2cf1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cee(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x2,%rax
jae    1166 <usage+0x56>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,8),%rsi
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <usage+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
lea    0xf18(%rip),%rbx
lea    0xee1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Maya Client ver 0.0.0\00"
@.str.1 = [26 x i8] c" Usage: user [options]\00"
@__const.usage.msgs = [2 x i8*] [i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [4 x i8] c"%s\0A\00"
define void @usage() {
%1 = alloca [2 x i8*]
%2 = alloca i32
%3 = bitcast [2 x i8*]* %1 to i8*
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = icmp ult i64 %6, 2
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Maya Client ver 0.0.0\00"
@.str.1 = [26 x i8] c" Usage: user [options]\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @usage() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int wfile_eitherslash(int c) { return (c == '\\' || c == '/'); }


x86 assembly (clang, -O0):
<wfile_eitherslash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x5c,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <wfile_eitherslash+0x20>
cmpl   $0x2f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_eitherslash>:
cmp    $0x5c,%edi
sete   %al
cmp    $0x2f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @wfile_eitherslash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 92
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 47
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @wfile_eitherslash(i32 %0) {
%2 = icmp eq i32 %0, 92
%3 = icmp eq i32 %0, 47
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ raise_lower_command(int);
void lower_command(void) { raise_lower_command(1); }


x86 assembly (clang, -O0):
<lower_command>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <raise_lower_command@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_command>:
mov    $0x1,%edi
jmp    1030 <raise_lower_command@plt>

LLVM IR (-O0):
define void @lower_command() {
%1 = call i32 @raise_lower_command(i32 1)
ret void
}

LLVM IR (-O2):
define void @lower_command() {
%1 = tail call i32 @raise_lower_command(i32 1)
ret void
}
int irdiv(int i, int div) {
  i = i * 2 / div;
  if (i & 1)
    i += (i > 0 ? 1 : -1);
  return (i / 2);
}


x86 assembly (clang, -O0):
<irdiv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113f <irdiv+0x3f>
mov    -0x4(%rbp),%edx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovg  %ecx,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<irdiv>:
lea    (%rdi,%rdi,1),%eax
cltd
idiv   %esi
mov    %eax,%ecx
and    $0x1,%ecx
neg    %ecx
xor    %edx,%edx
test   %eax,%eax
setg   %dl
add    %edx,%edx
add    $0xffffffff,%edx
and    %ecx,%edx
add    %edx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @irdiv(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 = mul nsw i32 %5, 2
%7 = load i32, i32* %4
%8 = sdiv i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 1
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 -1
%17 = load i32, i32* %3
%18 = add nsw i32 %17, %16
store i32 %18, i32* %3
br label %19
19: ; preds = %12, %2
%20 = load i32, i32* %3
%21 = sdiv i32 %20, 2
ret i32 %21
}

LLVM IR (-O2):
define i32 @irdiv(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = sdiv i32 %3, %1
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
%7 = icmp slt i32 %4, 1
%8 = select i1 %7, i32 -1, i32 1
%9 = select i1 %6, i32 0, i32 %8
%10 = add nsw i32 %9, %4
%11 = sdiv i32 %10, 2
ret i32 %11
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int);
void main() { printf("Factorial of 5 = %d\n", fact(5)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1040 <fact@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <fact@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Factorial of 5 = %d\0A\00"
define void @main() {
%1 = call i32 @fact(i32 5)
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Factorial of 5 = %d\0A\00"
define void @main() {
%1 = tail call i32 @fact(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
void foo(void *_printk, int a, char *c) {
  void (*ptr)(const char *, ...);
  ptr = _printk;
  ptr(c);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   *%rcx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rcx
mov    %rdx,%rdi
xor    %eax,%eax
jmp    *%rcx

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

LLVM IR (-O2):
define void @foo(i8* nocapture %0, i32 %1, i8* %2) {
%4 = bitcast i8* %0 to void (i8*, ...)*
tail call void (i8*, ...) %4(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int getFileDescriptor(char *filename, int flags, int mode) {
  int desc = open(filename, flags, mode);
  if (desc < 0) {
    perror("Error");
    exit(desc);
  }
  return desc;
}


x86 assembly (clang, -O0):
<getFileDescriptor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1172 <getFileDescriptor+0x42>
lea    0xe9b(%rip),%rdi
call   1040 <perror@plt>
mov    -0x14(%rbp),%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileDescriptor>:
push   %rbx
call   1030 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1140 <getFileDescriptor+0x10>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
call   1040 <perror@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Error\00"
define i32 @getFileDescriptor(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 i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @open(i8* %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %7
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %3
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
@.str = [6 x i8] c"Error\00"
define i32 @getFileDescriptor(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @open(i8* %0, i32 %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 %4)
unreachable
9: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int findN(unsigned int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  unsigned int a[8] = {1, 2, 3, 9, 6, 0, 0, 0};
  printf("\n%d", findN(a));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <findN@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <findN@plt>
lea    0xed6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.a = [8 x i32] [i32 1, i32 2, i32 3, i32 9, i32 6, i32 0, i32 0, i32 0]
@.str = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @findN(i32* %3)
%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*/ handle_WINCH(int /*<<< orphan*/);
int gen_WINCH() {
  handle_WINCH(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_WINCH>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_WINCH@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_WINCH>:
push   %rax
xor    %edi,%edi
call   1030 <handle_WINCH@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gen_WINCH() {
%1 = call i32 @handle_WINCH(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_WINCH() {
%1 = tail call i32 @handle_WINCH(i32 0)
ret i32 0
}
/* Variables and functions */
int istrsenvisx(char *, int /*<<< orphan*/ *, char const *, int /*<<< orphan*/,
                int, char *, int /*<<< orphan*/ *);
int strvis(char *mbdst, const char *mbsrc, int flags) {
  return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, "", NULL);
}


x86 assembly (clang, -O0):
<strvis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
lea    0xec4(%rip),%r9
movq   $0x0,(%rsp)
call   1030 <istrsenvisx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strvis>:
push   %rax
mov    %edx,%r8d
mov    %rsi,%rdx
movq   $0x0,(%rsp)
lea    0xeda(%rip),%r9
xor    %esi,%esi
xor    %ecx,%ecx
call   1030 <istrsenvisx@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @strvis(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @istrsenvisx(i8* %7, i32* null, i8* %8, i32 0, i32 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %10
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @strvis(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @istrsenvisx(i8* %0, i32* null, i8* %1, i32 0, i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %4
}
/* Variables and functions */
float rando();
float get_random(float min, float max) { return min + (max - min) * rando(); }


x86 assembly (clang, -O0):
<get_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rando@plt>
movss  -0x10(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0xc(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random>:
push   %rax
movss  %xmm0,0x4(%rsp)
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
xor    %eax,%eax
call   1030 <rando@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @get_random(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = load float, float* %3
%8 = fsub float %6, %7
%9 = call float (...) @rando()
%10 = call float @llvm.fmuladd.f32(float %8, float %9, float %5)
ret float %10
}

LLVM IR (-O2):
define float @get_random(float %0, float %1) {
%3 = fsub float %1, %0
%4 = tail call float (...) @rando()
%5 = tail call float @llvm.fmuladd.f32(float %3, float %4, float %0)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ write_src(char *);
void eq_handler(void) {
  write_src("{\n");
  write_src("imm_t b = POP();\n");
  write_src("imm_t a = POP();\n");
  write_src("PUSH(a==b);\n");
  write_src("}\n");
}


x86 assembly (clang, -O0):
<eq_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xedc(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee2(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee9(%rip),%rdi
call   1030 <write_src@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq_handler>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xedf(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeec(%rip),%rdi
pop    %rax
jmp    1030 <write_src@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [18 x i8] c"imm_t b = POP();\0A\00"
@.str.2 = [18 x i8] c"imm_t a = POP();\0A\00"
@.str.3 = [13 x i8] c"PUSH(a==b);\0A\00"
@.str.4 = [3 x i8] c"}\0A\00"
define void @eq_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @write_src(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [18 x i8] c"imm_t b = POP();\0A\00"
@.str.2 = [18 x i8] c"imm_t a = POP();\0A\00"
@.str.3 = [13 x i8] c"PUSH(a==b);\0A\00"
@.str.4 = [3 x i8] c"}\0A\00"
define void @eq_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @write_src(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int _FPU_DEFAULT;
int _FPU_MASK_IM;
int _FPU_MASK_OM;
int _FPU_MASK_ZM;
int /*<<< orphan*/ __setfpucw(int);
void __attribute__((constructor)) trapfpe() {
  __setfpucw(_FPU_DEFAULT & ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM));
}


x86 assembly (clang, -O0):
<trapfpe>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
mov    0x2eab(%rip),%rcx
or     (%rcx),%eax
mov    0x2e92(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    %eax,%edi
call   1030 <__setfpucw@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<trapfpe>:
mov    0x2ec9(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
mov    0x2e9f(%rip),%rax
or     (%rax),%edi
mov    0x2eb6(%rip),%rax
not    %edi
and    (%rax),%edi
jmp    1030 <__setfpucw@plt>

LLVM IR (-O0):
@_FPU_DEFAULT = global i32 0
@_FPU_MASK_IM = global i32 0
@_FPU_MASK_ZM = global i32 0
@_FPU_MASK_OM = global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @trapfpe, i8* null }]
define void @trapfpe() {
%1 = load i32, i32* @_FPU_DEFAULT
%2 = load i32, i32* @_FPU_MASK_IM
%3 = load i32, i32* @_FPU_MASK_ZM
%4 = or i32 %2, %3
%5 = load i32, i32* @_FPU_MASK_OM
%6 = or i32 %4, %5
%7 = xor i32 %6, -1
%8 = and i32 %1, %7
%9 = call i32 @__setfpucw(i32 %8)
ret void
}

LLVM IR (-O2):
@_FPU_DEFAULT = global i32 0
@_FPU_MASK_IM = global i32 0
@_FPU_MASK_ZM = global i32 0
@_FPU_MASK_OM = global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @trapfpe, i8* null }]
define void @trapfpe() {
%1 = load i32, i32* @_FPU_DEFAULT
%2 = load i32, i32* @_FPU_MASK_IM
%3 = load i32, i32* @_FPU_MASK_ZM
%4 = or i32 %3, %2
%5 = load i32, i32* @_FPU_MASK_OM
%6 = or i32 %4, %5
%7 = xor i32 %6, -1
%8 = and i32 %1, %7
%9 = tail call i32 @__setfpucw(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send12(char *, unsigned long);
int /*<<< orphan*/ send24(unsigned long);
void txaddr(unsigned long addr) {
  send12("/A", addr >> 24);
  send24(addr);
}


x86 assembly (clang, -O0):
<txaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
shr    $0x18,%rsi
lea    0xec5(%rip),%rdi
call   1030 <send12@plt>
mov    -0x8(%rbp),%rdi
call   1040 <send24@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txaddr>:
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%rsi
shr    $0x18,%rsi
lea    0xece(%rip),%rdi
call   1030 <send12@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <send24@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"/A\00"
define void @txaddr(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 24
%5 = call i32 @send12(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = load i64, i64* %2
%7 = call i32 @send24(i64 %6)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"/A\00"
define void @txaddr(i64 %0) {
%2 = lshr i64 %0, 24
%3 = tail call i32 @send12(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @send24(i64 %0)
ret void
}
/* Variables and functions */
char *strdup(char *);
char *extractString(char *start, char **end) {
  **end = '\0';
  *end = *end + 1;
  return strdup(start);
}


x86 assembly (clang, -O0):
<extractString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractString>:
mov    (%rsi),%rax
movb   $0x0,(%rax)
addq   $0x1,(%rsi)
jmp    1030 <strdup@plt>

LLVM IR (-O0):
define i8* @extractString(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = load i8*, i8** %5
store i8 0, i8* %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8**, i8*** %4
store i8* %9, i8** %10
%11 = load i8*, i8** %3
%12 = call i8* @strdup(i8* %11)
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @extractString(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
store i8 0, i8* %3
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %5, i8** %1
%6 = tail call i8* @strdup(i8* %0)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
scalar_t__ wordlength(int);
int main() {
  unsigned long int sum = 0;
  int i;
  for (i = 1; i <= 1000; i++)
    sum += wordlength(i);
  printf("\nSum is : %u", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jg     1169 <main+0x49>
mov    -0x14(%rbp),%edi
call   1040 <wordlength@plt>
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <main+0x1e>
mov    -0x10(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <wordlength@plt>
add    %rax,%rbx
add    $0x1,%ebp
cmp    $0x3e9,%ebp
jne    1130 <main+0x10>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"\0ASum is : %u\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i32 1, i32* %3
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 1000
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %3
%9 = call i64 @wordlength(i32 %8)
%10 = load i64, i64* %2
%11 = add i64 %10, %9
store i64 %11, i64* %2
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i64, i64* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0ASum is : %u\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %6, %1 ]
%3 = phi i64 [ 0, %0 ], [ %5, %1 ]
%4 = tail call i64 @wordlength(i32 %2)
%5 = add i64 %4, %3
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 1001
br i1 %7, label %8, label %1
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %5)
ret i32 0
}
/* Type definitions */
typedef double int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, double);
void printDiskUsage(int nfiles, int64_t nbytes) {
  printf("%d files  %g Kb\n", nfiles, nbytes / 1024.0);
}


x86 assembly (clang, -O0):
<printDiskUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDiskUsage>:
mov    %edi,%esi
mulsd  0xee6(%rip),%xmm0
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"%d files %g Kb\0A\00"
define void @printDiskUsage(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = load double, double* %4
%7 = fdiv double %6, 1.024000e+03
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5, double %7)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%d files %g Kb\0A\00"
define void @printDiskUsage(i32 %0, double %1) {
%3 = fmul double %1, 0x3F50000000000000
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0, double %3)
ret void
}
/* Variables and functions */
int _lv1_gpu_close();
int lv1_gpu_close(void) { return _lv1_gpu_close(); }


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

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

LLVM IR (-O0):
define i32 @lv1_gpu_close() {
%1 = call i32 (...) @_lv1_gpu_close()
ret i32 %1
}

LLVM IR (-O2):
define i32 @lv1_gpu_close() {
%1 = tail call i32 (...) @_lv1_gpu_close()
ret i32 %1
}
int test_imm_3Duint8_reg(unsigned char val) {
  return ((val) & (0x3D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Duint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x3d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_3Duint8_reg>:
test   $0x3d,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Duint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 61
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_3Duint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 61
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct timeval {
  unsigned long tv_sec;
  unsigned long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void ms_to_timeval(unsigned long ms, struct timeval *tv) {
  assert(tv != NULL);
  tv->tv_sec = ms / 1000L;
  tv->tv_usec = (ms % 1000L) * 1000L;
}


x86 assembly (clang, -O0):
<ms_to_timeval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
imul   $0x3e8,%rdx,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ms_to_timeval>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
shr    $0x4,%rdx
mov    %rdx,(%r14)
imul   $0x3e8,%rdx,%rax
sub    %rax,%rbx
imul   $0x3e8,%rbx,%rax
mov    %rax,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @ms_to_timeval(i64 %0, %struct.timeval* %1) {
%3 = alloca i64
%4 = alloca %struct.timeval*
store i64 %0, i64* %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = icmp ne %struct.timeval* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i64, i64* %3
%10 = udiv i64 %9, 1000
%11 = load %struct.timeval*, %struct.timeval** %4
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i64 %10, i64* %12
%13 = load i64, i64* %3
%14 = urem i64 %13, 1000
%15 = mul i64 %14, 1000
%16 = load %struct.timeval*, %struct.timeval** %4
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
store i64 %15, i64* %17
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @ms_to_timeval(i64 %0, %struct.timeval* writeonly %1) {
%3 = icmp ne %struct.timeval* %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = udiv i64 %0, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store i64 %6, i64* %7
%8 = urem i64 %0, 1000
%9 = mul nuw nsw i64 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store i64 %9, i64* %10
ret void
}
/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double now() {
  struct timespec n;
  clock_gettime(CLOCK_MONOTONIC, &n);
  return n.tv_sec + n.tv_nsec / 1e9;
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xec4(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
divsd  0xecb(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { double, i32 }
@CLOCK_MONOTONIC = global i32 0
define double @now() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 1.000000e+09
%10 = fadd double %5, %9
ret double %10
}

LLVM IR (-O2):
%struct.timespec = type { double, i32 }
@CLOCK_MONOTONIC = global i32 0
define double @now() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.000000e+09
%11 = fadd double %6, %10
ret double %11
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_EXTENSION;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_EXTENSION_it;
X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a, const unsigned char **in,
                                   long len) {
  return (X509_EXTENSION *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                         &X509_EXTENSION_it);
}


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

x86 assembly (clang, -O2):
<d2i_X509_EXTENSION>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@X509_EXTENSION_it = global i32 0
define i32* @d2i_X509_EXTENSION(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @X509_EXTENSION_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@X509_EXTENSION_it = global i32 0
define i32* @d2i_X509_EXTENSION(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @X509_EXTENSION_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
int check_if_config_exist(int tableau[100]) {
  int i = 0;
  return i;
}


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

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

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

LLVM IR (-O2):
define i32 @check_if_config_exist(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ to_binary(double);
int main() {
  to_binary(0.125);
  to_binary(0.1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movsd  0xeec(%rip),%xmm0
call   1030 <to_binary@plt>
movsd  0xed7(%rip),%xmm0
call   1030 <to_binary@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
call   1030 <to_binary@plt>
movsd  0xee2(%rip),%xmm0
call   1030 <to_binary@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @to_binary(double 1.250000e-01)
%2 = call i32 @to_binary(double 1.000000e-01)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @to_binary(double 1.250000e-01)
%2 = tail call i32 @to_binary(double 1.000000e-01)
ret i32 0
}