xunge/DecIR huggingface dataset:
int menorElemento(int *arr, int n) {
  int x;
  if (n == 0)
    return arr[n];
  x = menorElemento(arr, n - 1);
  if (x < arr[n])
    return x;
  else
    return arr[n];
}


x86 assembly (clang, -O0):
<menorElemento>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113c <menorElemento+0x2c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <menorElemento+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
call   1030 <menorElemento@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    116d <menorElemento+0x5d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <menorElemento+0x6b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menorElemento>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %esi,%esi
je     1138 <menorElemento+0x28>
mov    %esi,%ebx
lea    -0x1(%rbx),%esi
mov    %r14,%rdi
call   1030 <menorElemento@plt>
mov    %eax,%ecx
movslq %ebx,%rax
mov    (%r14,%rax,4),%eax
cmp    %eax,%ecx
cmovl  %ecx,%eax
jmp    113b <menorElemento+0x2b>
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @menorElemento(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* %0
br label %6
6: ; preds = %4, %8
%7 = phi i32 [ %15, %8 ], [ %5, %4 ]
ret i32 %7
8: ; preds = %2
%9 = add nsw i32 %1, -1
%10 = tail call i32 @menorElemento(i32* %0, i32 %9)
%11 = sext i32 %1 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp slt i32 %10, %13
%15 = select i1 %14, i32 %10, i32 %13
br label %6
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
scalar_t__ bind(int, struct sockaddr const *, int /*<<< orphan*/);
int /*<<< orphan*/ err_sys(char *);
void Bind(int fd, const struct sockaddr *sa, socklen_t salen) {
  if (bind(fd, sa, salen) < 0)
    err_sys("bind error");
}


x86 assembly (clang, -O0):
<Bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <bind@plt>
cmp    $0x0,%rax
jge    1157 <Bind+0x37>
lea    0xeae(%rip),%rdi
call   1030 <err_sys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bind>:
push   %rax
call   1040 <bind@plt>
test   %rax,%rax
js     112d <Bind+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <err_sys@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define void @Bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = load i32, i32* %6
%10 = call i64 @bind(i32 %7, %struct.sockaddr* %8, i32 %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [11 x i8] c"bind error\00"
define void @Bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i64 @bind(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
int addEm(int a, int b) {
  if (b == 0)
    return a;
  int sum = a ^ b;
  int carries = (a & b) << 1;
  return addEm(sum, carries);
}


x86 assembly (clang, -O0):
<addEm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <addEm+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <addEm+0x46>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <addEm@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addEm>:
test   %esi,%esi
je     111d <addEm+0x1d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %esi,%eax
xor    %edi,%eax
and    %edi,%esi
mov    %eax,%edi
add    %esi,%esi
jne    1110 <addEm+0x10>
ret
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @addEm(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = xor i32 %5, %6
%8 = and i32 %5, %6
%9 = shl i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ %0, %2 ], [ %7, %4 ]
ret i32 %12
}
void foo(int x, int y) {
  register int lr9 asm("r9") = x;
  register int lr10 asm("r10") = y;
  int foo;
  asm volatile("nop" : "=r"(lr9) : "r"(lr9), "r"(lr10));
  foo = lr9;
  lr9 = x;
  lr10 = foo;
  asm volatile("nop" : "=r"(lr9) : "r"(lr9), "r"(lr10));
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%r9d
mov    -0x10(%rbp),%r10d
nop
mov    %r9d,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%r9d
mov    -0x10(%rbp),%r10d
nop
mov    %r9d,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%r9d
mov    %esi,%r10d
nop
mov    %r9d,%r10d
mov    %edi,%r9d
nop
ret

LLVM IR (-O0):
define void @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
store i32 %8, i32* %5
%9 = load i32, i32* %4
store i32 %9, i32* %6
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 asm sideeffect "nop", "={r9},{r9},{r10},~{dirflag},~{fpsr},~{flags}"(i32 %10, i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
store i32 %13, i32* %7
%14 = load i32, i32* %3
store i32 %14, i32* %5
%15 = load i32, i32* %7
store i32 %15, i32* %6
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 asm sideeffect "nop", "={r9},{r9},{r10},~{dirflag},~{fpsr},~{flags}"(i32 %16, i32 %17)
store i32 %18, i32* %5
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = tail call i32 asm sideeffect "nop", "={r9},{r9},{r10},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
%4 = tail call i32 asm sideeffect "nop", "={r9},{r9},{r10},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %3)
ret void
}
/* Variables and functions */
int count(char *, int);
int getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main() {
  char *line = NULL;
  size_t t = 0;
  int size = getline(&line, &t, stdin);
  printf("%d\n", count(line, size - 1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
sub    $0x1,%esi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <getline@plt>
mov    0x8(%rsp),%rdi
lea    -0x1(%rax),%esi
call   1030 <count@plt>
lea    0xe8e(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i32 0, i32* %1
store i8* null, i8** %2
store i64 0, i64* %3
%5 = load i32, i32* @stdin
%6 = call i32 @getline(i8** %2, i64* %3, i32 %5)
store i32 %6, i32* %4
%7 = load i8*, i8** %2
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = call i32 @count(i8* %7, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = load i32, i32* @stdin
%6 = call i32 @getline(i8** %1, i64* %2, i32 %5)
%7 = load i8*, i8** %1
%8 = add nsw i32 %6, -1
%9 = call i32 @count(i8* %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printType(char type) {
  if (type == 'c') {
    printf("car");
  } else if (type == 'b') {
    printf("bus");
  } else {
    printf("truck");
  }
  return;
}


x86 assembly (clang, -O0):
<printType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x63,%eax
jne    113c <printType+0x2c>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <printType+0x5b>
movsbl -0x1(%rbp),%eax
cmp    $0x62,%eax
jne    115a <printType+0x4a>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <printType+0x56>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <printType+0x5b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printType>:
cmp    $0x62,%dil
lea    0xee9(%rip),%rax
lea    0xee6(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x63,%dil
lea    0xecf(%rip),%rdi
cmovne %rcx,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"car\00"
@.str.1 = [4 x i8] c"bus\00"
@.str.2 = [6 x i8] c"truck\00"
define void @printType(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 99
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %17
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 98
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
br label %17
17: ; preds = %16, %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"car\00"
@.str.1 = [4 x i8] c"bus\00"
@.str.2 = [6 x i8] c"truck\00"
define void @printType(i8 signext %0) {
%2 = icmp eq i8 %0, 98
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i8 %0, 99
%5 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3
%6 = tail call i32 @printf(i8* dereferenceable(1) %5)
ret void
}
int chmatchscore(unsigned char a, unsigned char b, int substmatrix[256][256]) {
  return substmatrix[a][b];
}


x86 assembly (clang, -O0):
<chmatchscore>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl -0x1(%rbp),%ecx
shl    $0xa,%rcx
add    %rcx,%rax
movzbl -0x2(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chmatchscore>:
mov    %edi,%eax
mov    %esi,%ecx
shl    $0xa,%rax
add    %rdx,%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @chmatchscore(i8 zeroext %0, i8 zeroext %1, [256 x i32]* %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca [256 x i32]*
store i8 %0, i8* %4
store i8 %1, i8* %5
store [256 x i32]* %2, [256 x i32]** %6
%7 = load [256 x i32]*, [256 x i32]** %6
%8 = load i8, i8* %4
%9 = zext i8 %8 to i64
%10 = getelementptr inbounds [256 x i32], [256 x i32]* %7, i64 %9
%11 = load i8, i8* %5
%12 = zext i8 %11 to i64
%13 = getelementptr inbounds [256 x i32], [256 x i32]* %10, i64 0, i64 %12
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @chmatchscore(i8 zeroext %0, i8 zeroext %1, [256 x i32]* nocapture %2) {
%4 = zext i8 %0 to i64
%5 = zext i8 %1 to i64
%6 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 %4, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}
int main(void) {
  int a[2];
  (a + 3);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [2 x i32]
%2 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%3 = getelementptr inbounds i32, i32* %2, i64 3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int O_CREAT;
int O_RDONLY;
int O_TRUNC;
int O_WRONLY;
scalar_t__ mode_is_writing(char const *);
int mode_to_flags(const char *mode) {
  return mode_is_writing(mode) ? O_WRONLY | O_TRUNC | O_CREAT : O_RDONLY;
}


x86 assembly (clang, -O0):
<mode_to_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mode_is_writing@plt>
cmp    $0x0,%rax
je     1152 <mode_to_flags+0x42>
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    0x2eb1(%rip),%rcx
or     (%rcx),%eax
mov    0x2eb0(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0xc(%rbp)
jmp    115e <mode_to_flags+0x4e>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_to_flags>:
push   %rax
call   1030 <mode_is_writing@plt>
test   %rax,%rax
je     1138 <mode_to_flags+0x28>
mov    0x2e9e(%rip),%rcx
mov    0x2ec7(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    0x2ec4(%rip),%rcx
or     (%rcx),%eax
pop    %rcx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@O_RDONLY = global i32 0
define i32 @mode_to_flags(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mode_is_writing(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* @O_WRONLY
%8 = load i32, i32* @O_TRUNC
%9 = or i32 %7, %8
%10 = load i32, i32* @O_CREAT
%11 = or i32 %9, %10
br label %14
12: ; preds = %1
%13 = load i32, i32* @O_RDONLY
br label %14
14: ; preds = %12, %6
%15 = phi i32 [ %11, %6 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@O_CREAT = global i32 0
@O_RDONLY = global i32 0
define i32 @mode_to_flags(i8* %0) {
%2 = tail call i64 @mode_is_writing(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = load i32, i32* @O_WRONLY
%6 = load i32, i32* @O_TRUNC
%7 = or i32 %6, %5
%8 = load i32, i32* @O_CREAT
%9 = or i32 %7, %8
br label %12
10: ; preds = %1
%11 = load i32, i32* @O_RDONLY
br label %12
12: ; preds = %10, %4
%13 = phi i32 [ %9, %4 ], [ %11, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void add(char *name, int x, int y) { printf("%s gives: %d\n", name, x + y); }


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    -0x10(%rbp),%edx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
mov    %rdi,%rax
add    %esi,%edx
lea    0xee4(%rip),%rdi
mov    %rax,%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%s gives: %d\0A\00"
define void @add(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = add nsw i32 %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s gives: %d\0A\00"
define void @add(i8* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4)
ret void
}
/* Type definitions */
struct bf_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bf_buffer_add(struct bf_buffer *, char *, int);
char *bf_buffer_extract(struct bf_buffer *, size_t *);
char *bf_buffer_extract_string(struct bf_buffer *buf, size_t *plen) {
  bf_buffer_add(buf, "\0", 1);
  return bf_buffer_extract(buf, plen);
}


x86 assembly (clang, -O0):
<bf_buffer_extract_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
mov    $0x1,%edx
call   1040 <bf_buffer_add@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <bf_buffer_extract@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_buffer_extract_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rsi
mov    $0x1,%edx
call   1040 <bf_buffer_add@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <bf_buffer_extract@plt>

LLVM IR (-O0):
%struct.bf_buffer = type { i32 }
@.str = [2 x i8] zeroinitializer
define i8* @bf_buffer_extract_string(%struct.bf_buffer* %0, i64* %1) {
%3 = alloca %struct.bf_buffer*
%4 = alloca i64*
store %struct.bf_buffer* %0, %struct.bf_buffer** %3
store i64* %1, i64** %4
%5 = load %struct.bf_buffer*, %struct.bf_buffer** %3
%6 = call i32 @bf_buffer_add(%struct.bf_buffer* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = load %struct.bf_buffer*, %struct.bf_buffer** %3
%8 = load i64*, i64** %4
%9 = call i8* @bf_buffer_extract(%struct.bf_buffer* %7, i64* %8)
ret i8* %9
}

LLVM IR (-O2):
%struct.bf_buffer = type { i32 }
@.str = [2 x i8] zeroinitializer
define i8* @bf_buffer_extract_string(%struct.bf_buffer* %0, i64* %1) {
%3 = tail call i32 @bf_buffer_add(%struct.bf_buffer* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i8* @bf_buffer_extract(%struct.bf_buffer* %0, i64* %1)
ret i8* %4
}
int work(int k, int l) { return k + l + 1; }


x86 assembly (clang, -O0):
<work>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<work>:
lea    (%rdi,%rsi,1),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @work(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 = add nsw i32 %5, %6
%8 = add nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @work(i32 %0, i32 %1) {
%3 = add i32 %0, 1
%4 = add i32 %3, %1
ret i32 %4
}
/* Type definitions */
struct c2interface {
  int dummy;
};

/* Variables and functions */
int EIO;
int /*<<< orphan*/ c2_write_ar(struct c2interface *, unsigned char);
scalar_t__ c2_write_dr(struct c2interface *, unsigned char);
int c2_write_sfr(struct c2interface *c2if, unsigned char sfr,
                 unsigned char data) {
  c2_write_ar(c2if, sfr);
  if (c2_write_dr(c2if, data) < 0)
    return -EIO;
  return 0;
}


x86 assembly (clang, -O0):
<c2_write_sfr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
movzbl -0x11(%rbp),%esi
call   1040 <c2_write_ar@plt>
mov    -0x10(%rbp),%rdi
movzbl -0x12(%rbp),%esi
call   1030 <c2_write_dr@plt>
cmp    $0x0,%rax
jge    116e <c2_write_sfr+0x4e>
xor    %eax,%eax
mov    0x2e7c(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1175 <c2_write_sfr+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2_write_sfr>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <c2_write_ar@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <c2_write_dr@plt>
mov    0x2ea2(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
sar    $0x3f,%rax
and    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.c2interface = type { i32 }
@EIO = global i32 0
define i32 @c2_write_sfr(%struct.c2interface* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca %struct.c2interface*
%6 = alloca i8
%7 = alloca i8
store %struct.c2interface* %0, %struct.c2interface** %5
store i8 %1, i8* %6
store i8 %2, i8* %7
%8 = load %struct.c2interface*, %struct.c2interface** %5
%9 = load i8, i8* %6
%10 = call i32 @c2_write_ar(%struct.c2interface* %8, i8 zeroext %9)
%11 = load %struct.c2interface*, %struct.c2interface** %5
%12 = load i8, i8* %7
%13 = call i64 @c2_write_dr(%struct.c2interface* %11, i8 zeroext %12)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load i32, i32* @EIO
%17 = sub nsw i32 0, %16
store i32 %17, i32* %4
br label %19
18: ; preds = %3
store i32 0, i32* %4
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.c2interface = type { i32 }
@EIO = global i32 0
define i32 @c2_write_sfr(%struct.c2interface* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = tail call i32 @c2_write_ar(%struct.c2interface* %0, i8 zeroext %1)
%5 = tail call i64 @c2_write_dr(%struct.c2interface* %0, i8 zeroext %2)
%6 = icmp slt i64 %5, 0
%7 = load i32, i32* @EIO
%8 = sub nsw i32 0, %7
%9 = select i1 %6, i32 %8, i32 0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHelp(void) {
  printf("Extract:\nAccession <tab> GI <tab> ORGANISM\nfrom a GenBank "
         "flatfile.\n");
}


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

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

LLVM IR (-O0):
@.str = [69 x i8] c"Extract:\0AAccession <tab> GI <tab> ORGANISM\0Afrom a GenBank flatfile.\0A\00"
define void @printHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [68 x i8] c"Extract:\0AAccession <tab> GI <tab> ORGANISM\0Afrom a GenBank flatfile.\00"
define void @printHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ strstr(char *, char *);
int test();
int main(int argc, char *argv[]) {
  if (strstr(argv[0], "test"))
    return test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strstr@plt>
cmp    $0x0,%rax
je     1162 <main+0x42>
mov    $0x0,%al
call   1040 <test@plt>
mov    %eax,-0x4(%rbp)
jmp    1169 <main+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    (%rsi),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strstr@plt>
test   %rax,%rax
je     113d <main+0x1d>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @strstr(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @test()
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 0, %2 ]
ret i32 %9
}
int foo(char a, unsigned short b) { return (a & !a) | (b & !b); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
movsbl -0x1(%rbp),%eax
cmpb   $0x0,-0x1(%rbp)
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
movzwl -0x4(%rbp),%ecx
cmpw   $0x0,-0x4(%rbp)
setne  %dl
xor    $0xff,%dl
and    $0x1,%dl
movzbl %dl,%edx
and    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %ecx,%ecx
test   %dil,%dil
sete   %cl
and    %edi,%ecx
xor    %eax,%eax
test   %esi,%esi
sete   %al
and    %esi,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @foo(i8 signext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %3
%8 = icmp ne i8 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = and i32 %6, %10
%12 = load i16, i16* %4
%13 = zext i16 %12 to i32
%14 = load i16, i16* %4
%15 = icmp ne i16 %14, 0
%16 = xor i1 %15, true
%17 = zext i1 %16 to i32
%18 = and i32 %13, %17
%19 = or i32 %11, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @foo(i8 signext %0, i16 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = icmp eq i8 %0, 0
%5 = zext i1 %4 to i32
%6 = and i32 %5, %3
%7 = zext i16 %1 to i32
%8 = icmp eq i16 %1, 0
%9 = zext i1 %8 to i32
%10 = and i32 %9, %7
%11 = or i32 %10, %6
ret i32 %11
}
/* Variables and functions */
int rand();
double randomVal(double max, double min) {
  return min + rand() % (int)(max - min);
}


x86 assembly (clang, -O0):
<randomVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
cvttsd2si %xmm1,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomVal>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @randomVal(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = call i32 (...) @rand()
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fsub double %7, %8
%10 = fptosi double %9 to i32
%11 = srem i32 %6, %10
%12 = sitofp i32 %11 to double
%13 = fadd double %5, %12
ret double %13
}

LLVM IR (-O2):
define double @randomVal(double %0, double %1) {
%3 = tail call i32 (...) @rand()
%4 = fsub double %0, %1
%5 = fptosi double %4 to i32
%6 = srem i32 %3, %5
%7 = sitofp i32 %6 to double
%8 = fadd double %7, %1
ret double %8
}
void lsdn_idalloc_free(struct lsdn_idalloc *idalloc) {}


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

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

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

LLVM IR (-O2):
%struct.lsdn_idalloc = type opaque
define void @lsdn_idalloc_free(%struct.lsdn_idalloc* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ helper();
int main() { helper(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @helper()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @helper()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int int32_t;

/* Variables and functions */
int get_lsbf_int32_t(int /*<<< orphan*/ *, int *, int);
int32_t get_lsbf_int32_t_sign_ext(uint8_t *buf, int32_t *bip, int32_t n) {
  int32_t a;
  a = get_lsbf_int32_t(buf, bip, n);
  if ((1 << (n - 1) & a) == 0) {
    a = (~((1 << n) - 1)) | a;
  }
  return (a);
}


x86 assembly (clang, -O0):
<get_lsbf_int32_t_sign_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <get_lsbf_int32_t@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    -0x18(%rbp),%eax
cmp    $0x0,%eax
jne    1165 <get_lsbf_int32_t_sign_ext+0x55>
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
xor    $0xffffffff,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_lsbf_int32_t_sign_ext>:
push   %rbx
mov    %edx,%ebx
call   1030 <get_lsbf_int32_t@plt>
lea    -0x1(%rbx),%ecx
movzbl %cl,%edx
mov    $0xffffffff,%esi
mov    %ebx,%ecx
shl    %cl,%esi
xor    %ecx,%ecx
bt     %edx,%eax
cmovae %esi,%ecx
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_lsbf_int32_t_sign_ext(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = call i32 @get_lsbf_int32_t(i32* %8, i32* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = sub nsw i32 %12, 1
%14 = shl i32 1, %13
%15 = load i32, i32* %7
%16 = and i32 %14, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %3
%19 = load i32, i32* %6
%20 = shl i32 1, %19
%21 = sub nsw i32 %20, 1
%22 = xor i32 %21, -1
%23 = load i32, i32* %7
%24 = or i32 %22, %23
store i32 %24, i32* %7
br label %25
25: ; preds = %18, %3
%26 = load i32, i32* %7
ret i32 %26
}

LLVM IR (-O2):
define i32 @get_lsbf_int32_t_sign_ext(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @get_lsbf_int32_t(i32* %0, i32* %1, i32 %2)
%5 = add nsw i32 %2, -1
%6 = shl nuw i32 1, %5
%7 = and i32 %4, %6
%8 = icmp eq i32 %7, 0
%9 = shl nsw i32 -1, %2
%10 = select i1 %8, i32 %9, i32 0
%11 = or i32 %10, %4
ret i32 %11
}
void test_two(int x, int y) {
#pragma omp target parallel for
  for (int i = 0; i < x; i++)
    for (int i = 0; i < y; i++)
      ;
}


x86 assembly (clang, -O0):
<test_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1156 <test_two+0x56>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1143 <test_two+0x43>
jmp    1135 <test_two+0x35>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1124 <test_two+0x24>
jmp    1148 <test_two+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <test_two+0x11>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_two(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
store i32 0, i32* %5
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %17, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
br label %17
17: ; preds = %16
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %12
20: ; preds = %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %7
24: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @test_two(i32 %0, i32 %1) {
ret void
}
void _sbrk_r() {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @_sbrk_r() {
br label %1
1: ; preds = %0, %1
br label %1
}
int rand_neg(void) {
  static unsigned int neg = 0;
  static int sign[8] = {0, 0, 0, 1, 1, 0, 1, 1};
  return sign[(neg++) % 8];
}


x86 assembly (clang, -O0):
<rand_neg>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f4a(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f3f(%rip)
and    $0x7,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2f0d(%rip),%rax
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_neg>:
mov    0x2f1e(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f15(%rip)
and    $0x7,%eax
lea    0xee7(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@rand_neg.neg = internal global i32 0
@rand_neg.sign = internal global [8 x i32] [i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1]
define i32 @rand_neg() {
%1 = load i32, i32* @rand_neg.neg
%2 = add i32 %1, 1
store i32 %2, i32* @rand_neg.neg
%3 = urem i32 %1, 8
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [8 x i32], [8 x i32]* @rand_neg.sign, i64 0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
@rand_neg.neg = internal unnamed_addr global i32 0
@rand_neg.sign = internal unnamed_addr constant [8 x i32] [i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1]
define i32 @rand_neg() {
%1 = load i32, i32* @rand_neg.neg
%2 = add i32 %1, 1
store i32 %2, i32* @rand_neg.neg
%3 = and i32 %1, 7
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [8 x i32], [8 x i32]* @rand_neg.sign, i64 0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ i2c_write_reg(int, int);
void i2c_write_control(int d) { i2c_write_reg(2, d); }


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

x86 assembly (clang, -O2):
<i2c_write_control>:
mov    %edi,%esi
mov    $0x2,%edi
jmp    1030 <i2c_write_reg@plt>

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

LLVM IR (-O2):
define void @i2c_write_control(i32 %0) {
%2 = tail call i32 @i2c_write_reg(i32 2, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CBUF_Empty();
int /*<<< orphan*/ UART_WriteString(int /*<<< orphan*/, char *);
int COMMAND_CAN_Version(void) {
  if (!CBUF_Empty())
    return -1;
  UART_WriteString(0, "1010");
  return 0;
}


x86 assembly (clang, -O0):
<COMMAND_CAN_Version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <CBUF_Empty@plt>
cmp    $0x0,%eax
jne    1144 <COMMAND_CAN_Version+0x24>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <COMMAND_CAN_Version+0x39>
xor    %edi,%edi
lea    0xeb3(%rip),%rsi
call   1040 <UART_WriteString@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<COMMAND_CAN_Version>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <CBUF_Empty@plt>
test   %eax,%eax
je     113e <COMMAND_CAN_Version+0x1e>
lea    0xecb(%rip),%rsi
xor    %edi,%edi
call   1040 <UART_WriteString@plt>
jmp    1143 <COMMAND_CAN_Version+0x23>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"1010\00"
define i32 @COMMAND_CAN_Version() {
%1 = alloca i32
%2 = call i32 (...) @CBUF_Empty()
%3 = icmp ne i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %0
store i32 -1, i32* %1
br label %7
5: ; preds = %0
%6 = call i32 @UART_WriteString(i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %7
7: ; preds = %5, %4
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [5 x i8] c"1010\00"
define i32 @COMMAND_CAN_Version() {
%1 = tail call i32 (...) @CBUF_Empty()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @UART_WriteString(i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ 0, %3 ], [ -1, %0 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello(void) { printf("hello, library world\n"); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"hello, library world\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"hello, library world\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void logout() {
  printf("Logging out\n");
  exit(0);
  return;
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Logging out\00"
define void @logout() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void enqueue_pushable_dl_task(struct rq *rq, struct task_struct *p) {}


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

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

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

LLVM IR (-O2):
%struct.rq = type opaque
%struct.task_struct = type opaque
define void @enqueue_pushable_dl_task(%struct.rq* nocapture %0, %struct.task_struct* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
void raint4096() {
  printf("\nChanging Read Ahead Cache size for Internal sdcard to 4096kb\n");
  char buf[256];
  sprintf(buf, "/system/bin/sh -c %s",
          "'echo 4096 > /sys/block/mmcblk0/queue/read_ahead_kb'");
  system(buf);
}


x86 assembly (clang, -O0):
<raint4096>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
lea    0xeea(%rip),%rsi
lea    0xef8(%rip),%rdx
call   1050 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <system@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raint4096>:
push   %rbx
sub    $0x100,%rsp
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rsi
lea    0xec3(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [63 x i8] c"\0AChanging Read Ahead Cache size for Internal sdcard to 4096kb\0A\00"
@.str.1 = [21 x i8] c"/system/bin/sh -c %s\00"
@.str.2 = [53 x i8] c"'echo 4096 > /sys/block/mmcblk0/queue/read_ahead_kb'\00"
define void @raint4096() {
%1 = alloca [256 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = call i32 @system(i8* %5)
ret void
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"/system/bin/sh -c %s\00"
@.str.2 = [53 x i8] c"'echo 4096 > /sys/block/mmcblk0/queue/read_ahead_kb'\00"
@str = [62 x i8] c"\0AChanging Read Ahead Cache size for Internal sdcard to 4096kb\00"
define void @raint4096() {
%1 = alloca [256 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @system(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void pr(void *ptr) { printf("100 == %d\n", (int)ptr); }


x86 assembly (clang, -O0):
<pr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"100 == %d\0A\00"
define void @pr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"100 == %d\0A\00"
define void @pr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *_basename(const char *path) {
  char *r;
  r = strrchr(path, '/');
  return r ? r + 1 : path;
}


x86 assembly (clang, -O0):
<_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <_basename+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <_basename+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @_basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %13
11: ; preds = %1
%12 = load i8*, i8** %2
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
char bar(char *arg) { return arg[3]; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
mov    0x3(%rdi),%al
ret

LLVM IR (-O0):
define signext i8 @bar(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = load i8, i8* %4
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @bar(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
ret i8 %3
}