xunge/DecIR huggingface dataset:
int rev(int num) {
  int ans = 0;
  while (num) {
    ans *= 10;
    ans += (num % 10);
    num /= 10;
  }
  return ans;
}


x86 assembly (clang, -O0):
<rev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1143 <rev+0x43>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <rev+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev>:
xor    %eax,%eax
test   %edi,%edi
je     113f <rev+0x3f>
cs nopw 0x0(%rax,%rax,1)
lea    (%rax,%rax,4),%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
lea    (%rsi,%rax,2),%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <rev+0x10>
ret

LLVM IR (-O0):
define i32 @rev(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* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 10
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = load i32, i32* %3
%13 = add nsw i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = sdiv i32 %14, 10
store i32 %15, i32* %2
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @rev(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = srem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = sdiv i32 %5, 10
%10 = add i32 %5, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %13
}
unsigned fp_regs_check(unsigned val) { return val; }


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

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

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

LLVM IR (-O2):
define i32 @fp_regs_check(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
struct eq {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct eq *);
void eq_free(struct eq *eq) { free(eq); }


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

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

LLVM IR (-O0):
%struct.eq = type { i32 }
define void @eq_free(%struct.eq* %0) {
%2 = alloca %struct.eq*
store %struct.eq* %0, %struct.eq** %2
%3 = load %struct.eq*, %struct.eq** %2
%4 = call i32 @free(%struct.eq* %3)
ret void
}

LLVM IR (-O2):
%struct.eq = type { i32 }
define void @eq_free(%struct.eq* nocapture %0) {
%2 = tail call i32 @free(%struct.eq* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_vd5();
int /*<<< orphan*/ take_struct_vd5(int /*<<< orphan*/);
void test_struct_vd5() { take_struct_vd5(return_struct_vd5()); }


x86 assembly (clang, -O0):
<test_struct_vd5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_vd5@plt>
mov    %eax,%edi
call   1030 <take_struct_vd5@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_vd5>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_vd5@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_vd5@plt>

LLVM IR (-O0):
define void @test_struct_vd5() {
%1 = call i32 (...) @return_struct_vd5()
%2 = call i32 @take_struct_vd5(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_vd5() {
%1 = tail call i32 (...) @return_struct_vd5()
%2 = tail call i32 @take_struct_vd5(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ noly_json_str_get_str(char *, char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
void test() {
  char val[128];
  char tmp[] = "{\"serial\":450024072,\"src\":\"700000165\",\"type\":5,"
               "\"version\":\"1.0\"}";
  noly_json_str_get_str(tmp, "serial", val, 128);
  printf("result : %s\n", val);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    -0xc0(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xedb(%rip),%rsi
mov    $0x80,%ecx
call   1050 <noly_json_str_get_str@plt>
lea    -0x80(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0xc0,%rsp
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xee2(%rip),%rsi
mov    %rsp,%rdi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdx
mov    $0x80,%ecx
call   1040 <noly_json_str_get_str@plt>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0xc0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test.tmp = [64 x i8] c"{\22serial\22:450024072,\22src\22:\22700000165\22,\22type\22:5,\22version\22:\221.0\22}\00"
@.str = [7 x i8] c"serial\00"
@.str.1 = [13 x i8] c"result : %s\0A\00"
define void @test() {
%1 = alloca [128 x i8]
%2 = alloca [64 x i8]
%3 = bitcast [64 x i8]* %2 to i8*
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%6 = call i32 @noly_json_str_get_str(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5, i32 128)
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@__const.test.tmp = [64 x i8] c"{\22serial\22:450024072,\22src\22:\22700000165\22,\22type\22:5,\22version\22:\221.0\22}\00"
@.str = [7 x i8] c"serial\00"
@.str.1 = [13 x i8] c"result : %s\0A\00"
define void @test() {
%1 = alloca [128 x i8]
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = call i32 @noly_json_str_get_str(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3, i32 128)
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int get_brightness(FILE *led_file) {
  char *line = NULL;
  char *ret_val = NULL;
  size_t len = 0;
  rewind(led_file);
  getline(&line, &len, led_file);
  ret_val = line;
  free(line);
  return atoi(ret_val);
}


x86 assembly (clang, -O0):
<get_brightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <getline@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <atoi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_brightness>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
call   1040 <rewind@plt>
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rbx,%rdx
call   1060 <getline@plt>
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1050 <atoi@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_brightness(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i32* %0, i32** %2
store i8* null, i8** %3
store i8* null, i8** %4
store i64 0, i64* %5
%6 = load i32*, i32** %2
%7 = call i32 @rewind(i32* %6)
%8 = load i32*, i32** %2
%9 = call i32 @getline(i8** %3, i64* %5, i32* %8)
%10 = load i8*, i8** %3
store i8* %10, i8** %4
%11 = load i8*, i8** %3
%12 = call i32 @free(i8* %11)
%13 = load i8*, i8** %4
%14 = call i32 @atoi(i8* %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @get_brightness(i32* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%6 = tail call i32 @rewind(i32* %0)
%7 = call i32 @getline(i8** %2, i64* %3, i32* %0)
%8 = load i8*, i8** %2
%9 = call i32 @free(i8* %8)
%10 = call i32 @atoi(i8* %8)
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMRE0_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRE0_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

LLVM IR (-O0):
define void @U_WMRE0_swap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_WMRE0_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int strlen(char *);
char *getBaseName(char *fn) {
  char *cp = fn + strlen(fn);
  for (cp--; cp >= fn; cp--)
    if (*cp == '/')
      break;
  return cp + 1;
}


x86 assembly (clang, -O0):
<getBaseName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     1182 <getBaseName+0x72>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    116c <getBaseName+0x5c>
jmp    1182 <getBaseName+0x72>
jmp    1171 <getBaseName+0x61>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1149 <getBaseName+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBaseName>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rcx
add    $0xffffffffffffffff,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,%rax
cmp    %rbx,%rcx
jb     1141 <getBaseName+0x31>
lea    -0x1(%rax),%rcx
cmpb   $0x2f,(%rax)
jne    1130 <getBaseName+0x20>
add    $0x1,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @getBaseName(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
br label %5
5: ; preds = %9, %1
%6 = phi i8* [ %4, %1 ], [ %7, %9 ]
%7 = getelementptr inbounds i8, i8* %6, i64 -1
%8 = icmp ult i8* %7, %0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 47
br i1 %11, label %12, label %5
12: ; preds = %9, %5
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void resize(int width, int height) { glViewport(0, 0, width, height); }


x86 assembly (clang, -O0):
<resize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1030 <glViewport@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resize>:
mov    %esi,%ecx
mov    %edi,%edx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <glViewport@plt>

LLVM IR (-O0):
define void @resize(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 = call i32 @glViewport(i32 0, i32 0, i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @resize(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
ret void
}
double double_clip(double d, double min, double max) {
  if (d < min)
    return min;
  if (d > max)
    return max;
  return d;
}


x86 assembly (clang, -O0):
<double_clip>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <double_clip+0x36>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <double_clip+0x5f>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1155 <double_clip+0x55>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <double_clip+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_clip>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @double_clip(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load double, double* %6
store double %12, double* %4
br label %21
13: ; preds = %3
%14 = load double, double* %5
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double, double* %7
store double %18, double* %4
br label %21
19: ; preds = %13
%20 = load double, double* %5
store double %20, double* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load double, double* %4
ret double %22
}

LLVM IR (-O2):
define double @double_clip(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}
main() {
  struct A {
    int i, j;
  } a = {1, 2};
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.A = type { i32, i32 }
@__const.main.a = %struct.A { i32 1, i32 2 }
define i32 @main() {
%1 = alloca %struct.A
%2 = bitcast %struct.A* %1 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mq_unlink(char *);
void exitFunction() { mq_unlink("/server_queue"); }


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

x86 assembly (clang, -O2):
<exitFunction>:
lea    0xee9(%rip),%rdi
jmp    1030 <mq_unlink@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"/server_queue\00"
define void @exitFunction() {
%1 = call i32 @mq_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"/server_queue\00"
define void @exitFunction() {
%1 = tail call i32 @mq_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int readUInt8(int /*<<< orphan*/ *);
int readUInt16(FILE *f) { return readUInt8(f) + (readUInt8(f) << 8); }


x86 assembly (clang, -O0):
<readUInt16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <readUInt8@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <readUInt8@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
shl    $0x8,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readUInt16>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <readUInt8@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <readUInt8@plt>
shl    $0x8,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @readUInt16(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @readUInt8(i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @readUInt8(i32* %5)
%7 = shl i32 %6, 8
%8 = add nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @readUInt16(i32* %0) {
%2 = tail call i32 @readUInt8(i32* %0)
%3 = tail call i32 @readUInt8(i32* %0)
%4 = shl i32 %3, 8
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int ft_strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int);
void ft_putstr(char const *s) {
  int l;
  l = ft_strlen(s);
  write(1, s, l);
  return;
}


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @ft_putstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @ft_strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i32 @write(i32 1, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @ft_putstr(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t len = 0U;
  while (*(str++))
    ++len;
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1139 <strlen+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 0, i64* %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
%7 = load i8, i8* %5
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i64, i64* %3
%11 = add i64 %10, 1
store i64 %11, i64* %3
br label %4
12: ; preds = %4
%13 = load i64, i64* %3
ret i64 %13
}

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Variables and functions */
int ia64_get_cpuid(int);
int pfm_ia64_get_cpu_family(void) {
  return (int)((ia64_get_cpuid(3) >> 24) & 0xff);
}


x86 assembly (clang, -O0):
<pfm_ia64_get_cpu_family>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <ia64_get_cpuid@plt>
sar    $0x18,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfm_ia64_get_cpu_family>:
push   %rax
mov    $0x3,%edi
call   1030 <ia64_get_cpuid@plt>
shr    $0x18,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pfm_ia64_get_cpu_family() {
%1 = call i32 @ia64_get_cpuid(i32 3)
%2 = ashr i32 %1, 24
%3 = and i32 %2, 255
ret i32 %3
}

LLVM IR (-O2):
define i32 @pfm_ia64_get_cpu_family() {
%1 = tail call i32 @ia64_get_cpuid(i32 3)
%2 = lshr i32 %1, 24
ret i32 %2
}
int getopt_long(argc, argv, options, long_options, opt_index)
int argc;
char **argv;
const char *options;
const struct option *long_options;
int *opt_index;
{ return _getopt_internal(argc, argv, options, long_options, opt_index, 0); }


x86 assembly (clang, -O0):
<getopt_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
mov    $0x0,%al
call   1030 <_getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long>:
xor    %r9d,%r9d
xor    %eax,%eax
jmp    1030 <_getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type opaque
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...) bitcast (i32 (...)* @_getopt_internal to i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...)*)(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 0)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type opaque
define i32 @getopt_long(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...) bitcast (i32 (...)* @_getopt_internal to i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...)*)(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 0)
ret i32 %6
}
const char *uproc_features_zlib_version(void) { return "no"; }


x86 assembly (clang, -O0):
<uproc_features_zlib_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uproc_features_zlib_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"no\00"
define i8* @uproc_features_zlib_version() {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [3 x i8] c"no\00"
define i8* @uproc_features_zlib_version() {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void _wfe(unsigned user_gpio, unsigned level, uint32_t tick, void *user) {
  *(int *)user = 1;
}


x86 assembly (clang, -O0):
<_wfe>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_wfe>:
movl   $0x1,(%rcx)
ret

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

LLVM IR (-O2):
define void @_wfe(i32 %0, i32 %1, i32 %2, i8* nocapture writeonly %3) {
%5 = bitcast i8* %3 to i32*
store i32 1, i32* %5
ret void
}
int bar(void) {
  static void *b[] = {&&addr};
  void *p = baz(b);
  goto *p;
addr:
  return 17;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2f09(%rip),%rdi
mov    $0x0,%al
call   1030 <baz@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <bar+0x34>
mov    $0x11,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<bar>:
push   %rax
lea    0x2f10(%rip),%rdi
xor    %eax,%eax
call   1030 <baz@plt>
mov    $0x11,%eax
pop    %rcx
ret

LLVM IR (-O0):
@bar.b = internal global [1 x i8*] [i8* blockaddress(@bar, %6)]
define i32 @bar() {
%1 = alloca i8*
%2 = call i32 (i8**, ...) bitcast (i32 (...)* @baz to i32 (i8**, ...)*)(i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @bar.b, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
%5 = load i8*, i8** %1
br label %7
6: ; preds = %7
ret i32 17
7: ; preds = %0
%8 = phi i8* [ %5, %0 ]
indirectbr i8* %8, [label %6]
}

LLVM IR (-O2):
@bar.b = internal global [1 x i8*] [i8* blockaddress(@bar, %2)]
define i32 @bar() {
%1 = tail call i32 (i8**, ...) bitcast (i32 (...)* @baz to i32 (i8**, ...)*)(i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @bar.b, i64 0, i64 0))
br label %2
2: ; preds = %0
ret i32 17
}
void dac_semiconduct() {}


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

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

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

LLVM IR (-O2):
define void @dac_semiconduct() {
ret void
}
void nand_deselect() { *((volatile unsigned long *)0x70200004) |= 1 << 1; }


x86 assembly (clang, -O0):
<nand_deselect>:
push   %rbp
mov    %rsp,%rbp
mov    $0x70200004,%eax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    $0x70200004,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_deselect>:
orq    $0x2,0x70200004
70 02
ret

LLVM IR (-O0):
define void @nand_deselect() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = or i64 %1, 2
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
ret void
}

LLVM IR (-O2):
define void @nand_deselect() {
%1 = load volatile i64, i64* inttoptr (i64 1881145348 to i64*)
%2 = or i64 %1, 2
store volatile i64 %2, i64* inttoptr (i64 1881145348 to i64*)
ret void
}
/* Variables and functions */
scalar_t__ isdigit(unsigned char);
char toupper(unsigned char);
int hex2dec(unsigned char hex_digit) {
  if (isdigit(hex_digit))
    return hex_digit - '0';
  else
    return toupper(hex_digit) - 'A' + 10;
}


x86 assembly (clang, -O0):
<hex2dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1150 <hex2dec+0x30>
movzbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <hex2dec+0x45>
movzbl -0x5(%rbp),%edi
call   1040 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2dec>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
je     1135 <hex2dec+0x15>
movzbl %bl,%eax
add    $0xffffffd0,%eax
pop    %rbx
ret
movzbl %bl,%edi
call   1040 <toupper@plt>
movsbl %al,%eax
add    $0xffffffc9,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hex2dec(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isdigit(i8 zeroext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %2
br label %17
11: ; preds = %1
%12 = load i8, i8* %3
%13 = call signext i8 @toupper(i8 zeroext %12)
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 65
%16 = add nsw i32 %15, 10
store i32 %16, i32* %2
br label %17
17: ; preds = %11, %7
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @hex2dec(i8 zeroext %0) {
%2 = tail call i64 @isdigit(i8 zeroext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = zext i8 %0 to i32
%6 = add nsw i32 %5, -48
br label %11
7: ; preds = %1
%8 = tail call signext i8 @toupper(i8 zeroext %0)
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, -55
br label %11
11: ; preds = %7, %4
%12 = phi i32 [ %6, %4 ], [ %10, %7 ]
ret i32 %12
}
void __INIT() {}


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

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

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

LLVM IR (-O2):
define void @__INIT() {
ret void
}
int main(int argc, char **argv) {
  static char buffer[4096];
  __builtin___clear_cache(buffer, buffer + sizeof(buffer));
  return 0;
}


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

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

LLVM IR (-O0):
@main.buffer = internal global [4096 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
ret i32 0
}

LLVM IR (-O2):
@main.buffer = internal global [4096 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture readnone %1) {
tail call void @llvm.clear_cache(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buffer, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @main.buffer, i64 1, i64 0))
ret i32 0
}
/* Variables and functions */
double __nv_fdim(double, double);
double fdim(double __a, double __b) { return __nv_fdim(__a, __b); }


x86 assembly (clang, -O0):
<fdim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <__nv_fdim@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdim>:
jmp    1030 <__nv_fdim@plt>

LLVM IR (-O0):
define double @fdim(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @__nv_fdim(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @fdim(double %0, double %1) {
%3 = tail call double @__nv_fdim(double %0, double %1)
ret double %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
float __hsail_unpackcvt(uint32_t val, uint32_t index) {
  return (float)((val >> (index * 8)) & 0xff);
}


x86 assembly (clang, -O0):
<__hsail_unpackcvt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
sar    %cl,%eax
and    $0xff,%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_unpackcvt>:
lea    0x0(,%rsi,8),%ecx
sar    %cl,%edi
movzbl %dil,%eax
cvtsi2ss %eax,%xmm0
ret

LLVM IR (-O0):
define float @__hsail_unpackcvt(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 = mul nsw i32 %6, 8
%8 = ashr i32 %5, %7
%9 = and i32 %8, 255
%10 = sitofp i32 %9 to float
ret float %10
}

LLVM IR (-O2):
define float @__hsail_unpackcvt(i32 %0, i32 %1) {
%3 = shl nsw i32 %1, 3
%4 = ashr i32 %0, %3
%5 = and i32 %4, 255
%6 = sitofp i32 %5 to float
ret float %6
}
/* Variables and functions */
int fs_write(int fildes, void *buf, size_t nbyte) { return -1; }


x86 assembly (clang, -O0):
<fs_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fs_write(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
ret i32 -1
}

LLVM IR (-O2):
define i32 @fs_write(i32 %0, i8* nocapture readnone %1, i64 %2) {
ret i32 -1
}
void DefaultIntHandler(void) {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<DefaultIntHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <DefaultIntHandler+0x9>
jmp    1109 <DefaultIntHandler+0x9>

x86 assembly (clang, -O2):
<DefaultIntHandler>:
jmp    1100 <DefaultIntHandler>

LLVM IR (-O0):
define void @DefaultIntHandler() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @DefaultIntHandler() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ drawBmpfile(int /*<<< orphan*/, int, char *);
int /*<<< orphan*/ sleep(int);
void sadFace() {
  drawBmpfile(0, 127, "Black eye");
  sleep(2000);
}


x86 assembly (clang, -O0):
<sadFace>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x7f,%esi
lea    0xece(%rip),%rdx
call   1030 <drawBmpfile@plt>
mov    $0x7d0,%edi
call   1040 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sadFace>:
push   %rax
lea    0xed8(%rip),%rdx
xor    %edi,%edi
mov    $0x7f,%esi
call   1030 <drawBmpfile@plt>
mov    $0x7d0,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Black eye\00"
define void @sadFace() {
%1 = call i32 @drawBmpfile(i32 0, i32 127, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @sleep(i32 2000)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Black eye\00"
define void @sadFace() {
%1 = tail call i32 @drawBmpfile(i32 0, i32 127, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @sleep(i32 2000)
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int c = 1;
  while (c != EOF)
    printf("[%d]\n", c = getchar());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1165 <main+0x45>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%esi
mov    %esi,-0x8(%rbp)
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%r14
cmpl   $0x1,(%r14)
je     1158 <main+0x38>
lea    0xec8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
cmp    (%r14),%ebp
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [6 x i8] c"[%d]\0A\00"
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = icmp eq i32 %1, 1
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @getchar()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %4, %6
br i1 %7, label %8, label %3
8: ; preds = %3, %0
ret i32 0
}
unsigned xrop3_42_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T & S;
  stk2 = ~stk2;
  stk1 = D & stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_42_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_42_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
and    %edi,%esi
not    %sil
movzbl %sil,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_42_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = and i8 %1, %0
%6 = xor i8 %5, -1
%7 = zext i8 %6 to i32
%8 = xor i32 %4, -1
%9 = and i32 %7, %8
%10 = or i32 %9, %3
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void do_501(char *buf) {
  strcpy(buf, "HTTP/1.0 501 Not Implemented\r\n");
  strcat(buf, "Content-type: text/plain\r\n");
  strcat(buf, "\r\n");
  strcat(buf, "That command is not yet implemented\r\n");
}


x86 assembly (clang, -O0):
<do_501>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xed8(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_501>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xed6(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xee5(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"HTTP/1.0 501 Not Implemented\0D\0A\00"
@.str.1 = [27 x i8] c"Content-type: text/plain\0D\0A\00"
@.str.2 = [3 x i8] c"\0D\0A\00"
@.str.3 = [38 x i8] c"That command is not yet implemented\0D\0A\00"
define void @do_501(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"HTTP/1.0 501 Not Implemented\0D\0A\00"
@.str.1 = [27 x i8] c"Content-type: text/plain\0D\0A\00"
@.str.2 = [3 x i8] c"\0D\0A\00"
@.str.3 = [38 x i8] c"That command is not yet implemented\0D\0A\00"
define void @do_501(i8* %0) {
%2 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
ret void
}
__attribute__((no, noclone)) int m0(int A, int B) {
  int C = A & B;
  int D = A ^ B;
  return C ^ D;
}


x86 assembly (clang, -O0):
<m0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @m0(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = and i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = xor i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = xor i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @m0(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
int printk_ratelimit(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @printk_ratelimit() {
ret i32 1
}
/* Variables and functions */
scalar_t__ testAlign();
scalar_t__ testPacked();
scalar_t__ testUnused(int /*<<< orphan*/);
int main() {
  int failed = 0;
  failed += testPacked();
  failed += testAlign();
  failed += testUnused(0);
  return failed;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <testPacked@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <testAlign@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
call   1040 <testUnused@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <testPacked@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1050 <testAlign@plt>
mov    %rax,%rbx
add    %r14d,%ebx
xor    %edi,%edi
call   1040 <testUnused@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i64 (...) @testPacked()
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = add nsw i64 %5, %3
%7 = trunc i64 %6 to i32
store i32 %7, i32* %2
%8 = call i64 (...) @testAlign()
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
%13 = call i64 @testUnused(i32 0)
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %2
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @testPacked()
%2 = tail call i64 (...) @testAlign()
%3 = add i64 %2, %1
%4 = tail call i64 @testUnused(i32 0)
%5 = add i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
int func(void) {
  int n = 3;
  int m = 5;
  n += m;
  return 0;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @func() {
ret i32 0
}
void jac_chain_nm2_incref(void) {}


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

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

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

LLVM IR (-O2):
define void @jac_chain_nm2_incref() {
ret void
}
/* Variables and functions */
int fib(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%i\n", fib(10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1040 <fib@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = tail call i32 @fib(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
double dtrunc(x)
double x;
{
  int k;
  k = (int)x;
  x = (double)k;
  return x;
}


x86 assembly (clang, -O0):
<dtrunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtrunc>:
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @dtrunc(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
%4 = load double, double* %2
%5 = fptosi double %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sitofp i32 %6 to double
store double %7, double* %2
%8 = load double, double* %2
ret double %8
}

LLVM IR (-O2):
define double @dtrunc(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to double
ret double %3
}
put_delta() {}


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

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

LLVM IR (-O0):
define i32 @put_delta() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @put_delta() {
ret i32 undef
}