xunge/DecIR huggingface dataset:
int main(int argc, const char *argv[]) {
  char word[] = {'w', 'o', 'r', 'd', '!'};
  char world[] = {'w', 'o', 'r', 'l', 'd', '!', '\0'};
  char *str = "Hello";
  char hello[] = "Hello";
  char line[10] = "Hello";
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xee8(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xee3(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xee5(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    0xedf(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0xed7(%rip),%al
mov    %al,-0x16(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x2e(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x2a(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe9b(%rip),%ax
mov    %ax,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.word = [5 x i8] c"word!"
@__const.main.world = [7 x i8] c"world!\00"
@.str = [6 x i8] c"Hello\00"
@__const.main.hello = [6 x i8] c"Hello\00"
@__const.main.line = [10 x i8] c"Hello\00\00\00\00\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i8]
%7 = alloca [7 x i8]
%8 = alloca i8*
%9 = alloca [6 x i8]
%10 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [5 x i8]* %6 to i8*
%12 = bitcast [7 x i8]* %7 to i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %8
%13 = bitcast [6 x i8]* %9 to i8*
%14 = bitcast [10 x i8]* %10 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void RTDirOpen(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDirOpen() {
ret void
}
/* Variables and functions */
void *malloc(int);
void *myalloc(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<myalloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @myalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
void zero(char *p) { memset(p, '\0', 2048); }


x86 assembly (clang, -O0):
<zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero>:
xor    %esi,%esi
mov    $0x800,%edx
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @zero(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i8 signext 0, i32 2048)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i;
  typedef int NUM[5];
  NUM n;
  for (i = 0; i < 5; i++) {
    n[i] = i;
    printf("%d\n", n[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1164 <main+0x54>
mov    -0x14(%rbp),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *);
main() {
  void *vp = 0;
  int *ip = 0;
  printf("%p\n", vp);
  printf("%p\n", ip);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

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

/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, int *, int);
void unpack_uv16(float *u_coord, float *v_coord, void const *input) {
  uint32_t val = *(uint32_t *)input;
  uint32_t u_val = val & 0xffff0000;
  uint32_t v_val = val << 16;
  memcpy(u_coord, &u_val, sizeof(*u_coord));
  memcpy(v_coord, &v_val, sizeof(*v_coord));
}


x86 assembly (clang, -O0):
<unpack_uv16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0xffff0000,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpack_uv16>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    (%rdx),%eax
mov    %eax,%ecx
and    $0xffff0000,%ecx
mov    %ecx,0xc(%rsp)
shl    $0x10,%eax
mov    %eax,0x8(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @unpack_uv16(float* %0, float* %1, i8* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store float* %0, float** %4
store float* %1, float** %5
store i8* %2, i8** %6
%10 = load i8*, i8** %6
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = and i32 %13, -65536
store i32 %14, i32* %8
%15 = load i32, i32* %7
%16 = shl i32 %15, 16
store i32 %16, i32* %9
%17 = load float*, float** %4
%18 = call i32 @memcpy(float* %17, i32* %8, i32 4)
%19 = load float*, float** %5
%20 = call i32 @memcpy(float* %19, i32* %9, i32 4)
ret void
}

LLVM IR (-O2):
define void @unpack_uv16(float* %0, float* %1, i8* nocapture %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i8* %2 to i32*
%7 = load i32, i32* %6
%8 = bitcast i32* %4 to i8*
%9 = and i32 %7, -65536
store i32 %9, i32* %4
%10 = bitcast i32* %5 to i8*
%11 = shl i32 %7, 16
store i32 %11, i32* %5
%12 = call i32 @memcpy(float* %0, i32* %4, i32 4)
%13 = call i32 @memcpy(float* %1, i32* %5, i32 4)
ret void
}
int fun867() { return 867; }


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

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

LLVM IR (-O0):
define i32 @fun867() {
ret i32 867
}

LLVM IR (-O2):
define i32 @fun867() {
ret i32 867
}
int main(void) {
  int x___0;
  int x___1;
  {
    x___0 = 6;
    x___1 = 7;
    return (x___1);
    return (x___0);
  }
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 7
}
/* Type definitions */
struct rtc_device {
  int dummy;
};
struct i2c_client {
  int dummy;
};

/* Variables and functions */
struct rtc_device *i2c_get_clientdata(struct i2c_client *);
int /*<<< orphan*/ rtc_device_unregister(struct rtc_device *);
int ds1672_remove(struct i2c_client *client) {
  struct rtc_device *rtc = i2c_get_clientdata(client);
  if (rtc)
    rtc_device_unregister(rtc);
  return 0;
}


x86 assembly (clang, -O0):
<ds1672_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <i2c_get_clientdata@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <ds1672_remove+0x2d>
mov    -0x10(%rbp),%rdi
call   1040 <rtc_device_unregister@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds1672_remove>:
push   %rax
call   1030 <i2c_get_clientdata@plt>
test   %rax,%rax
je     1133 <ds1672_remove+0x13>
mov    %rax,%rdi
call   1040 <rtc_device_unregister@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.i2c_client = type { i32 }
%struct.rtc_device = type { i32 }
define i32 @ds1672_remove(%struct.i2c_client* %0) {
%2 = alloca %struct.i2c_client*
%3 = alloca %struct.rtc_device*
store %struct.i2c_client* %0, %struct.i2c_client** %2
%4 = load %struct.i2c_client*, %struct.i2c_client** %2
%5 = call %struct.rtc_device* @i2c_get_clientdata(%struct.i2c_client* %4)
store %struct.rtc_device* %5, %struct.rtc_device** %3
%6 = load %struct.rtc_device*, %struct.rtc_device** %3
%7 = icmp ne %struct.rtc_device* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load %struct.rtc_device*, %struct.rtc_device** %3
%10 = call i32 @rtc_device_unregister(%struct.rtc_device* %9)
br label %11
11: ; preds = %8, %1
ret i32 0
}

LLVM IR (-O2):
%struct.i2c_client = type { i32 }
%struct.rtc_device = type { i32 }
define i32 @ds1672_remove(%struct.i2c_client* %0) {
%2 = tail call %struct.rtc_device* @i2c_get_clientdata(%struct.i2c_client* %0)
%3 = icmp eq %struct.rtc_device* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @rtc_device_unregister(%struct.rtc_device* %2)
br label %6
6: ; preds = %4, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main(int argc, char **argv) {
  char s[] = "This is a simple test for reverse.";
  reverse(s);
  printf("%s\n", s);
  reverse(s);
  printf("%s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x23,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x40(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x40(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x2e6573,0x1f(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <reverse@plt>
lea    0xecb(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s = [35 x i8] c"This is a simple test for reverse.\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [35 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [35 x i8]* %6 to i8*
%8 = getelementptr inbounds [35 x i8], [35 x i8]* %6, i64 0, i64 0
%9 = call i32 @reverse(i8* %8)
%10 = getelementptr inbounds [35 x i8], [35 x i8]* %6, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [35 x i8], [35 x i8]* %6, i64 0, i64 0
%13 = call i32 @reverse(i8* %12)
%14 = getelementptr inbounds [35 x i8], [35 x i8]* %6, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [35 x i8] c"This is a simple test for reverse.\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [35 x i8]
%4 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%5 = call i32 @reverse(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i32 @reverse(i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
void gencvt_w_s() {}


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

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

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

LLVM IR (-O2):
define void @gencvt_w_s() {
ret void
}
/* Variables and functions */
int access(char const *, int);
int eaccess(const char *pathname, int mode) { return access(pathname, mode); }


x86 assembly (clang, -O0):
<eaccess>:
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 <access@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eaccess>:
jmp    1030 <access@plt>

LLVM IR (-O0):
define i32 @eaccess(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 @access(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @eaccess(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @access(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/ *);
int main() {
  if (access("*.c", F_OK) == 0)
    printf("*.c exist %s\n", NULL);
  else
    printf("*.c don't exist %s\n", NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1040 <access@plt>
cmp    $0x0,%rax
jne    1163 <main+0x43>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <printf@plt>
jmp    1173 <main+0x53>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <access@plt>
test   %rax,%rax
lea    0xec4(%rip),%rax
lea    0xecb(%rip),%rdi
cmove  %rax,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"*.c\00"
@F_OK = global i32 0
@.str.1 = [14 x i8] c"*.c exist %s\0A\00"
@.str.2 = [20 x i8] c"*.c don't exist %s\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @F_OK
%3 = call i64 @access(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32* null)
br label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32* null)
br label %9
9: ; preds = %7, %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"*.c\00"
@F_OK = global i32 0
@.str.1 = [14 x i8] c"*.c exist %s\0A\00"
@.str.2 = [20 x i8] c"*.c don't exist %s\0A\00"
define i32 @main() {
%1 = load i32, i32* @F_OK
%2 = tail call i64 @access(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i32* null)
ret i32 0
}
float d2f(double a) { return (float)a; }


x86 assembly (clang, -O0):
<d2f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2f>:
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @d2f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptrunc double %3 to float
ret float %4
}

LLVM IR (-O2):
define float @d2f(double %0) {
%2 = fptrunc double %0 to float
ret float %2
}
int execute_epoll_wait() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_epoll_wait() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int usage(const char *argv0) {
  fprintf(
      stderr,
      "Usage: %s <private key file> <listen port> <target ip> <target port>\n",
      argv0);
  return 1;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [70 x i8] c"Usage: %s <private key file> <listen port> <target ip> <target port>\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [70 x i8] c"Usage: %s <private key file> <listen port> <target ip> <target port>\0A\00"
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
scalar_t__ pow(double, double);
double sqrt(scalar_t__);
double _freq3db(double freq, int order) {
  return freq / sqrt(pow(2.0, 1.0 / ((double)order)) - 1.0);
}


x86 assembly (clang, -O0):
<_freq3db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xeb5(%rip),%xmm0
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
movsd  0xe9b(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_freq3db>:
push   %rax
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  0xecb(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xec7(%rip),%xmm0
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xeba(%rip),%xmm0
cvttsd2si %xmm0,%rdi
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @_freq3db(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = load i32, i32* %4
%7 = sitofp i32 %6 to double
%8 = fdiv double 1.000000e+00, %7
%9 = call i64 @pow(double 2.000000e+00, double %8)
%10 = sitofp i64 %9 to double
%11 = fsub double %10, 1.000000e+00
%12 = fptosi double %11 to i64
%13 = call double @sqrt(i64 %12)
%14 = fdiv double %5, %13
ret double %14
}

LLVM IR (-O2):
define double @_freq3db(double %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fdiv double 1.000000e+00, %3
%5 = tail call i64 @pow(double 2.000000e+00, double %4)
%6 = sitofp i64 %5 to double
%7 = fadd double %6, -1.000000e+00
%8 = fptosi double %7 to i64
%9 = tail call double @sqrt(i64 %8)
%10 = fdiv double %0, %9
ret double %10
}
/* Variables and functions */
void *malloc(int);
void *Allocator(int numbytes) { return malloc(numbytes); }


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

x86 assembly (clang, -O2):
<Allocator>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @Allocator(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
char *center(char *s, int n, char fillchar) {}


x86 assembly (clang, -O0):
<center>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @center(i8* %0, i32 %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%8 = load i8*, i8** %4
ret i8* %8
}

LLVM IR (-O2):
define noalias i8* @center(i8* nocapture readnone %0, i32 %1, i8 signext %2) {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ tor_log_close_sigsafe_err_fds();
void tor_raw_abort_(void) {
  tor_log_close_sigsafe_err_fds();
  abort();
}


x86 assembly (clang, -O0):
<tor_raw_abort_>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <tor_log_close_sigsafe_err_fds@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<tor_raw_abort_>:
push   %rax
xor    %eax,%eax
call   1040 <tor_log_close_sigsafe_err_fds@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @tor_raw_abort_() {
%1 = call i32 (...) @tor_log_close_sigsafe_err_fds()
%2 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @tor_raw_abort_() {
%1 = tail call i32 (...) @tor_log_close_sigsafe_err_fds()
%2 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int /*<<< orphan*/ asbits(unsigned int, int, int);
unsigned int invert(unsigned int, int, int);
int main() {
  int offset = 27;
  int len = 7;
  unsigned x = 0x12345678;
  asbits(x, sizeof(x), 1);
  asbits(invert(x, offset, len), sizeof(x), 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1b,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
movl   $0x12345678,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <asbits@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <invert@plt>
mov    %eax,%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <asbits@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x12345678,%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <asbits@plt>
mov    $0x12345678,%edi
mov    $0x1b,%esi
mov    $0x7,%edx
call   1030 <invert@plt>
mov    %eax,%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <asbits@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 27, i32* %2
store i32 7, i32* %3
store i32 305419896, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @asbits(i32 %5, i32 4, i32 1)
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @invert(i32 %7, i32 %8, i32 %9)
%11 = call i32 @asbits(i32 %10, i32 4, i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @asbits(i32 305419896, i32 4, i32 1)
%2 = tail call i32 @invert(i32 305419896, i32 27, i32 7)
%3 = tail call i32 @asbits(i32 %2, i32 4, i32 1)
ret i32 0
}
__attribute__((always_)) void mpol_fix_fork_child_flag(struct task_struct *p) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @mpol_fix_fork_child_flag(%struct.task_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ barrier();
void putc(int c) {
  while ((*(volatile unsigned char *)0x101F1018) & (1 << 5))
    barrier();
  (*(volatile unsigned char *)0x101F1000) = c;
}


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x101f1018,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     113d <putc+0x2d>
mov    $0x0,%al
call   1030 <barrier@plt>
jmp    111b <putc+0xb>
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    $0x101f1000,%eax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
push   %rbx
mov    %edi,%ebx
testb  $0x20,0x101f1018
20
je     1131 <putc+0x21>
nopl   (%rax)
xor    %eax,%eax
call   1030 <barrier@plt>
testb  $0x20,0x101f1018
20
jne    1120 <putc+0x10>
mov    %bl,0x101f1000
pop    %rbx
ret

LLVM IR (-O0):
define void @putc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %8, %1
%4 = load volatile i8, i8* inttoptr (i64 270471192 to i8*)
%5 = zext i8 %4 to i32
%6 = and i32 %5, 32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = call i32 (...) @barrier()
br label %3
10: ; preds = %3
%11 = load i32, i32* %2
%12 = trunc i32 %11 to i8
store volatile i8 %12, i8* inttoptr (i64 270471168 to i8*)
ret void
}

LLVM IR (-O2):
define void @putc(i32 %0) {
%2 = load volatile i8, i8* inttoptr (i64 270471192 to i8*)
%3 = and i8 %2, 32
%4 = icmp eq i8 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1, %5
%6 = tail call i32 (...) @barrier()
%7 = load volatile i8, i8* inttoptr (i64 270471192 to i8*)
%8 = and i8 %7, 32
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %1
%11 = trunc i32 %0 to i8
store volatile i8 %11, i8* inttoptr (i64 270471168 to i8*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ koncz();
void sigint_handler() { koncz(); }


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

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

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

LLVM IR (-O2):
define void @sigint_handler() {
%1 = tail call i32 (...) @koncz()
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void EPIFIFOConfig(uint32_t ui32Base, uint32_t ui32Config) {
  ASSERT(ui32Base == 0x400D0000);
  ASSERT(ui32Config == (ui32Config & 0x00030077));
  (*((volatile uint32_t *)(ui32Base + 0x00000200))) = ui32Config;
}


x86 assembly (clang, -O0):
<EPIFIFOConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x400d0000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
and    $0x30077,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x200,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPIFIFOConfig>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x400d0000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xfffcff88,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    %ebx,0x200(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @EPIFIFOConfig(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 = icmp eq i32 %5, 1074593792
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = load i32, i32* %4
%11 = and i32 %10, 196727
%12 = icmp eq i32 %9, %11
%13 = zext i1 %12 to i32
%14 = call i32 @ASSERT(i32 %13)
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 512
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store volatile i32 %15, i32* %19
ret void
}

LLVM IR (-O2):
define void @EPIFIFOConfig(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1074593792
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = and i32 %1, 196727
%7 = icmp eq i32 %6, %1
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = add nsw i32 %0, 512
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %1, i32* %12
ret void
}
float dobro_do_maior(float x, float y) { return x > y ? x * 2 : y * 2; }


x86 assembly (clang, -O0):
<dobro_do_maior>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1134 <dobro_do_maior+0x34>
movss  0xedb(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1146 <dobro_do_maior+0x46>
movss  0xec4(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobro_do_maior>:
maxss  %xmm1,%xmm0
addss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @dobro_do_maior(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 = fcmp ogt float %5, %6
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load float, float* %3
%10 = fmul float %9, 2.000000e+00
br label %14
11: ; preds = %2
%12 = load float, float* %4
%13 = fmul float %12, 2.000000e+00
br label %14
14: ; preds = %11, %8
%15 = phi float [ %10, %8 ], [ %13, %11 ]
ret float %15
}

LLVM IR (-O2):
define float @dobro_do_maior(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
%5 = fmul float %4, 2.000000e+00
ret float %5
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *clone(const char *str) {
  char *copy = (char *)malloc(strlen(str) + 1);
  strcpy(copy, str);
  return copy;
}


x86 assembly (clang, -O0):
<clone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clone>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @clone(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @clone(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
char *getstring(int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char *mystring = (char *)malloc(2550);
  mystring = getstring(25, 1);
  fputs(mystring, stdout);
  fputc('\n', stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x9f6,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x19,%edi
mov    $0x1,%esi
call   1030 <getstring@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1050 <fputc@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x9f6,%edi
call   1060 <malloc@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   1030 <getstring@plt>
mov    0x2e7f(%rip),%rbx
mov    (%rbx),%esi
mov    %rax,%rdi
call   1040 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1050 <fputc@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @malloc(i32 2550)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %6
%9 = call i8* @getstring(i32 25, i32 1)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = load i32, i32* @stdout
%12 = call i32 @fputs(i8* %10, i32 %11)
%13 = load i32, i32* @stdout
%14 = call i32 @fputc(i8 signext 10, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 2550)
%4 = tail call i8* @getstring(i32 25, i32 1)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fputs(i8* %4, i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputc(i8 signext 10, i32 %7)
ret i32 0
}
int fclose() {}


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

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

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

LLVM IR (-O2):
define i32 @fclose() {
ret i32 undef
}
foo() {
  struct X {
    int a;
    int b;
  } xyz;
}


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

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

LLVM IR (-O0):
%struct.X = type { i32, i32 }
define i32 @foo() {
%1 = alloca i32
%2 = alloca %struct.X
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
%struct.X = type { i32, i32 }
define i32 @foo() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float, float);
int main() {
  float pi = 3.14;
  float nope = 9.99;
  printf("%f %f %f\n", pi + nope, pi * nope, pi > nope ? nope : pi);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1175 <main+0x65>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    117f <main+0x6f>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef4(%rip),%rdi
movss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
movss  0xed8(%rip),%xmm2
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%f %f %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x40091EB860000000, float* %2
store float 0x4023FAE140000000, float* %3
%4 = load float, float* %2
%5 = load float, float* %3
%6 = fadd float %4, %5
%7 = load float, float* %2
%8 = load float, float* %3
%9 = fmul float %7, %8
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fcmp ogt float %10, %11
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = load float, float* %3
br label %17
15: ; preds = %0
%16 = load float, float* %2
br label %17
17: ; preds = %15, %13
%18 = phi float [ %14, %13 ], [ %16, %15 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float %6, float %9, float %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%f %f %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float 0x402A428F60000000, float 0x403F5E5CA0000000, float 0x40091EB860000000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void AND_HOST_REG_L(int dst_reg, int src_reg) {
  addbyte(0x21);
  addbyte(0xc0 | dst_reg | (src_reg << 3));
}


x86 assembly (clang, -O0):
<AND_HOST_REG_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x21,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
or     $0xc0,%edi
mov    -0x8(%rbp),%eax
shl    $0x3,%eax
or     %eax,%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AND_HOST_REG_L>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x21,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebx
or     %ebp,%ebx
or     $0xc0,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @AND_HOST_REG_L(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 33)
%6 = load i32, i32* %3
%7 = or i32 192, %6
%8 = load i32, i32* %4
%9 = shl i32 %8, 3
%10 = or i32 %7, %9
%11 = call i32 @addbyte(i32 %10)
ret void
}

LLVM IR (-O2):
define void @AND_HOST_REG_L(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 33)
%4 = shl i32 %1, 3
%5 = or i32 %4, %0
%6 = or i32 %5, 192
%7 = tail call i32 @addbyte(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_crlf();
int /*<<< orphan*/ uart_send_string(char *);
void send_fail(void) {
  uart_send_string("FAIL");
  uart_send_crlf();
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"FAIL\00"
define void @send_fail() {
%1 = call i32 @uart_send_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @uart_send_crlf()
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"FAIL\00"
define void @send_fail() {
%1 = tail call i32 @uart_send_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @uart_send_crlf()
ret void
}
/* Variables and functions */
double tan(double);
double double_tan(double val) { return tan(val); }


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

x86 assembly (clang, -O2):
<double_tan>:
jmp    1030 <tan@plt>

LLVM IR (-O0):
define double @double_tan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @tan(double %3)
ret double %4
}

LLVM IR (-O2):
define double @double_tan(double %0) {
%2 = tail call double @tan(double %0)
ret double %2
}
int est_get_api_level(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @est_get_api_level() {
ret i32 3
}

LLVM IR (-O2):
define i32 @est_get_api_level() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
char *s_let(char *, char *);
scalar_t__ str2dir(int /*<<< orphan*/, char *, char, char);
char *macsubst2dir(char *arg) {
  char tmp[10240];
  if (str2dir(get_string(arg), tmp, '+', '-') == 0)
    tmp[1] = '\0';
  return (s_let(tmp + 1, arg));
}


x86 assembly (clang, -O0):
<macsubst2dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2810,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_string@plt>
mov    %eax,%edi
lea    -0x2810(%rbp),%rsi
mov    $0x2b,%edx
mov    $0x2d,%ecx
call   1050 <str2dir@plt>
cmp    $0x0,%rax
jne    1171 <macsubst2dir+0x41>
movb   $0x0,-0x280f(%rbp)
lea    -0x2810(%rbp),%rdi
add    $0x1,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <s_let@plt>
add    $0x2810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macsubst2dir>:
push   %rbx
sub    $0x2800,%rsp
mov    %rdi,%rbx
call   1040 <get_string@plt>
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x2b,%edx
mov    $0x2d,%ecx
call   1050 <str2dir@plt>
test   %rax,%rax
jne    115e <macsubst2dir+0x2e>
movb   $0x0,0x1(%rsp)
lea    0x1(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <s_let@plt>
add    $0x2800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @macsubst2dir(i8* %0) {
%2 = alloca i8*
%3 = alloca [10240 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @get_string(i8* %4)
%6 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 0
%7 = call i64 @str2dir(i32 %5, i8* %6, i8 signext 43, i8 signext 45)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 1
store i8 0, i8* %10
br label %11
11: ; preds = %9, %1
%12 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8*, i8** %2
%15 = call i8* @s_let(i8* %13, i8* %14)
ret i8* %15
}

LLVM IR (-O2):
define i8* @macsubst2dir(i8* %0) {
%2 = alloca [10240 x i8]
%3 = getelementptr inbounds [10240 x i8], [10240 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @get_string(i8* %0)
%5 = call i64 @str2dir(i32 %4, i8* %3, i8 signext 43, i8 signext 45)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = getelementptr inbounds [10240 x i8], [10240 x i8]* %2, i64 0, i64 1
store i8 0, i8* %8
br label %9
9: ; preds = %7, %1
%10 = getelementptr inbounds [10240 x i8], [10240 x i8]* %2, i64 0, i64 1
%11 = call i8* @s_let(i8* %10, i8* %0)
ret i8* %11
}
/* Variables and functions */
char *strchr(char *, char);
char *replace_char(char *str, char find, char replace) {
  char *current_pos = strchr(str, find);
  while (current_pos) {
    *current_pos = replace;
    current_pos = strchr(current_pos + 1, find);
  }
  return str;
}


x86 assembly (clang, -O0):
<replace_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1166 <replace_char+0x56>
mov    -0xa(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
jmp    1138 <replace_char+0x28>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_char>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <strchr@plt>
test   %rax,%rax
je     1145 <replace_char+0x35>
movsbl %bpl,%ebp
nopl   0x0(%rax)
mov    %bl,(%rax)
add    $0x1,%rax
mov    %rax,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <replace_char+0x20>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @replace_char(i8* returned %0, i8 signext %1, i8 signext %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %9, %6 ], [ %4, %3 ]
store i8 %2, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = tail call i8* @strchr(i8* %8, i8 signext %1)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %6
11: ; preds = %6, %3
ret i8* %0
}