xunge/DecIR huggingface dataset:
short lcg_rand(void) {
  static unsigned long lcg_prev = 12345;
  lcg_prev = lcg_prev * 69069 + 3;
  return lcg_prev & 0xffff;
}


x86 assembly (clang, -O0):
<lcg_rand>:
push   %rbp
mov    %rsp,%rbp
imul   $0x10dcd,0x2f11(%rip),%rax
add    $0x3,%rax
mov    %rax,0x2f06(%rip)
mov    0x2eff(%rip),%rax
and    $0xffff,%rax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcg_rand>:
imul   $0x10dcd,0x2f15(%rip),%rax
add    $0x3,%rax
mov    %rax,0x2f0a(%rip)
ret

LLVM IR (-O0):
@lcg_rand.lcg_prev = internal global i64 12345
define signext i16 @lcg_rand() {
%1 = load i64, i64* @lcg_rand.lcg_prev
%2 = mul i64 %1, 69069
%3 = add i64 %2, 3
store i64 %3, i64* @lcg_rand.lcg_prev
%4 = load i64, i64* @lcg_rand.lcg_prev
%5 = and i64 %4, 65535
%6 = trunc i64 %5 to i16
ret i16 %6
}

LLVM IR (-O2):
@lcg_rand.lcg_prev = internal unnamed_addr global i64 12345
define signext i16 @lcg_rand() {
%1 = load i64, i64* @lcg_rand.lcg_prev
%2 = mul i64 %1, 69069
%3 = add i64 %2, 3
store i64 %3, i64* @lcg_rand.lcg_prev
%4 = trunc i64 %3 to i16
ret i16 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hobbes, 2015\n");
  printf("The George Washington University\n");
  printf("leet peh\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"hobbes, 2015\0A\00"
@.str.1 = [34 x i8] c"The George Washington University\0A\00"
@.str.2 = [10 x i8] c"leet peh\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"hobbes, 2015\00"
@str.3 = [33 x i8] c"The George Washington University\00"
@str.4 = [9 x i8] c"leet peh\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
main(int argc, char **argv) {
  (void)printf("hello world.\n");
  exit(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)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello world.\0A\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 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [13 x i8] c"hello world.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x3c() {
  Assert_real((isdigit(60) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              305, ("isdigit should be 0 for <"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x3c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3c,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x131,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x3c>:
push   %rax
mov    $0x3c,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x131,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for <\00"
define void @t_isdigit_0x3c() {
%1 = call i64 @isdigit(i32 60)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for <\00"
define void @t_isdigit_0x3c() {
%1 = tail call i64 @isdigit(i32 60)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ excluiDoArquivo(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **);
int /*<<< orphan*/ system(char *);
void exibeTelaExclusao() {
  char ra[7];
  system("cls");
  printf("Entre com o RA a ser excluido do arquivo: ");
  scanf("%s", &ra);
  excluiDoArquivo(ra);
}


x86 assembly (clang, -O0):
<exibeTelaExclusao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <system@plt>
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
lea    -0x7(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x7(%rbp),%rdi
call   1030 <excluiDoArquivo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exibeTelaExclusao>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <system@plt>
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x9(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <excluiDoArquivo@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [43 x i8] c"Entre com o RA a ser excluido do arquivo: \00"
@.str.2 = [3 x i8] c"%s\00"
define void @exibeTelaExclusao() {
%1 = alloca [7 x i8]
%2 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast [7 x i8]* %1 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %4)
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%7 = call i32 @excluiDoArquivo(i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.1 = [43 x i8] c"Entre com o RA a ser excluido do arquivo: \00"
@.str.2 = [3 x i8] c"%s\00"
define void @exibeTelaExclusao() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast [7 x i8]* %1 to i8**
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %5)
%7 = call i32 @excluiDoArquivo(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Delay1Ms();
void DelayMs(int nMs) {
  int i;
  for (i = 0; i < nMs; i++) {
    Delay1Ms();
  }
}


x86 assembly (clang, -O0):
<DelayMs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1143 <DelayMs+0x33>
mov    $0x0,%al
call   1030 <Delay1Ms@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <DelayMs+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DelayMs>:
push   %rbx
test   %edi,%edi
jle    112c <DelayMs+0x1c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <Delay1Ms@plt>
add    $0xffffffff,%ebx
jne    1120 <DelayMs+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @DelayMs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 (...) @Delay1Ms()
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @DelayMs(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 (...) @Delay1Ms()
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
int ocrk(int a, int b) { return (a | ~b) ? 23 : 42; }


x86 assembly (clang, -O0):
<ocrk>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
or     %eax,%edx
mov    $0x2a,%eax
mov    $0x17,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ocrk>:
not    %esi
or     %edi,%esi
mov    $0x2a,%ecx
mov    $0x17,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ocrk(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %6, -1
%8 = or i32 %5, %7
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 23, i32 42
ret i32 %11
}

LLVM IR (-O2):
define i32 @ocrk(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = or i32 %3, %0
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 42, i32 23
ret i32 %6
}
float EMaxFloat(float a, float b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<EMaxFloat>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112c <EMaxFloat+0x2c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1136 <EMaxFloat+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @EMaxFloat(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 %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @EMaxFloat(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int minSubArrayLen(int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int a[] = {1, 2, 3, 4, 5};
  printf("%d\n", minSubArrayLen(11, a, 5));
  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)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0xb,%edi
mov    $0x5,%edx
call   1040 <minSubArrayLen@plt>
mov    %eax,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.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 [5 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [5 x i32]* %6 to i8*
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%9 = call i32 @minSubArrayLen(i32 11, i32* %8, i32 5)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%6 = call i32 @minSubArrayLen(i32 11, i32* %5, i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int core3_safe(char const *);
int U_EMRSETPOLYFILLMODE_safe(const char *record) {
  return (core3_safe(record));
}


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

x86 assembly (clang, -O2):
<U_EMRSETPOLYFILLMODE_safe>:
jmp    1030 <core3_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRSETPOLYFILLMODE_safe(i8* %0) {
%2 = tail call i32 @core3_safe(i8* %0)
ret i32 %2
}
void pthread_exit() {}


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

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

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

LLVM IR (-O2):
define void @pthread_exit() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __u64;

/* Variables and functions */
int hea_test_u64_bit(int /*<<< orphan*/ const, int);
int hea_cq_aer_cq_threshold_exceed_warn_check(const __u64 *aer) {
  return hea_test_u64_bit(*aer, 51);
}


x86 assembly (clang, -O0):
<hea_cq_aer_cq_threshold_exceed_warn_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0x33,%esi
call   1030 <hea_test_u64_bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hea_cq_aer_cq_threshold_exceed_warn_check>:
mov    (%rdi),%edi
mov    $0x33,%esi
jmp    1030 <hea_test_u64_bit@plt>

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

LLVM IR (-O2):
define i32 @hea_cq_aer_cq_threshold_exceed_warn_check(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @hea_test_u64_bit(i32 %2, i32 51)
ret i32 %3
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int nanosleep(struct timespec *, struct timespec *);
void wait_for(struct timespec delay) {
  struct timespec rest = {};
  while (nanosleep(&delay, &rest) == -1) {
    delay = rest;
  }
}


x86 assembly (clang, -O0):
<wait_for>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <nanosleep@plt>
cmp    $0xffffffff,%eax
jne    115c <wait_for+0x3c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    113b <wait_for+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,0x10(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <nanosleep@plt>
cmp    $0xffffffff,%eax
jne    1168 <wait_for+0x58>
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <nanosleep@plt>
cmp    $0xffffffff,%eax
je     1150 <wait_for+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define void @wait_for(i32 %0) {
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
store i32 %0, i32* %4
%5 = bitcast %struct.timespec* %3 to i8*
br label %6
6: ; preds = %9, %1
%7 = call i32 @nanosleep(%struct.timespec* %2, %struct.timespec* %3)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = bitcast %struct.timespec* %2 to i8*
%11 = bitcast %struct.timespec* %3 to i8*
br label %6
12: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define void @wait_for(i32 %0) {
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %0, i32* %4
%5 = bitcast %struct.timespec* %3 to i8*
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
store i32 0, i32* %6
%7 = call i32 @nanosleep(%struct.timespec* %2, %struct.timespec* %3)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %1, %9
%10 = load i32, i32* %6
store i32 %10, i32* %4
%11 = call i32 @nanosleep(%struct.timespec* %2, %struct.timespec* %3)
%12 = icmp eq i32 %11, -1
br i1 %12, label %9, label %13
13: ; preds = %9, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gfx_get_display_video_yuv_pitch(unsigned long *,
                                                   unsigned long *);
void redcloud_get_video_yuv_pitch(unsigned long *ypitch,
                                  unsigned long *uvpitch) {
  gfx_get_display_video_yuv_pitch(ypitch, uvpitch);
}


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

x86 assembly (clang, -O2):
<redcloud_get_video_yuv_pitch>:
jmp    1030 <gfx_get_display_video_yuv_pitch@plt>

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

LLVM IR (-O2):
define void @redcloud_get_video_yuv_pitch(i64* %0, i64* %1) {
%3 = tail call i32 @gfx_get_display_video_yuv_pitch(i64* %0, i64* %1)
ret void
}
int test(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @test() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int pclose(FILE *stream) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<pclose>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pclose>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @pclose(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @pclose(i32* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i32 -1
}
void ctl_expression(int channel, int val) {}


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

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

LLVM IR (-O0):
define void @ctl_expression(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @ctl_expression(i32 %0, i32 %1) {
ret void
}
int rd(int instruction) { return (instruction >> 11) & 0x0000001f; }


x86 assembly (clang, -O0):
<rd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xb,%eax
and    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd>:
mov    %edi,%eax
shr    $0xb,%eax
and    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @rd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 11
%5 = and i32 %4, 31
ret i32 %5
}

LLVM IR (-O2):
define i32 @rd(i32 %0) {
%2 = lshr i32 %0, 11
%3 = and i32 %2, 31
ret i32 %3
}
struct s3c24x0_dmas *s3c24x0_get_base_dmas(void) {
  return (struct s3c24x0_dmas *)0x14600000;
}


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

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

LLVM IR (-O0):
%struct.s3c24x0_dmas = type opaque
define %struct.s3c24x0_dmas* @s3c24x0_get_base_dmas() {
ret %struct.s3c24x0_dmas* inttoptr (i64 341835776 to %struct.s3c24x0_dmas*)
}

LLVM IR (-O2):
%struct.s3c24x0_dmas = type opaque
define %struct.s3c24x0_dmas* @s3c24x0_get_base_dmas() {
ret %struct.s3c24x0_dmas* inttoptr (i64 341835776 to %struct.s3c24x0_dmas*)
}
/* Variables and functions */
int *malloc(int);
int *do_an_allocation() {
  int *a = malloc(sizeof(int));
  int *b = a;
  *a = 4;
  return b;
}


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

x86 assembly (clang, -O2):
<do_an_allocation>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
movl   $0x4,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i32* @do_an_allocation() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i32* @malloc(i32 4)
store i32* %3, i32** %1
%4 = load i32*, i32** %1
store i32* %4, i32** %2
%5 = load i32*, i32** %1
store i32 4, i32* %5
%6 = load i32*, i32** %2
ret i32* %6
}

LLVM IR (-O2):
define noalias i32* @do_an_allocation() {
%1 = tail call i32* @malloc(i32 4)
store i32 4, i32* %1
ret i32* %1
}
float multi(float a, float b) { return a * b; }


x86 assembly (clang, -O0):
<multi>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<multi>:
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @multi(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 = fmul float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @multi(float %0, float %1) {
%3 = fmul float %0, %1
ret float %3
}
int fun(char *a) {
  if (!(*a))
    return 0;
  return fun(a + 1) + 1;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1135 <fun+0x25>
movl   $0x0,-0x4(%rbp)
jmp    1148 <fun+0x38>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <fun@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
cmpb   $0x0,(%rdi)
je     111c <fun+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <fun+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @fun(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = add nuw nsw i32 %6, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int exists(char *filePath) {
  struct stat st;
  return (stat(filePath, &st) == 0);
}


x86 assembly (clang, -O0):
<exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a[5];
  int i, s;
  a[0] = a[1] = a[3] = a[4] = 0;
  s = 0;
  for (i = 0; i < 5; i++)
    s += a[i];
  if (s == 377)
    printf("sum is %d\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    116f <main+0x5f>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1149 <main+0x39>
cmpl   $0x179,-0x28(%rbp)
jne    118b <main+0x7b>
mov    -0x28(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
unsigned int fact_tail(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
unsigned int main() {
  unsigned int N = 100;
  unsigned int a = 1;
  unsigned int result = 0;
  result = fact_tail(N, a);
  printf("the factorial of: %u is %u\n", N, result);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"the factorial of: %u is %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 100, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @fact_tail(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"the factorial of: %u is %u\0A\00"
define i32 @main() {
%1 = tail call i32 @fact_tail(i32 100, i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 100, i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ OSReadSwapInt16(int /*<<< orphan*/ *, int /*<<< orphan*/);
uint16_t _OSSwapInt16(uint16_t data) { return OSReadSwapInt16(&data, 0); }


x86 assembly (clang, -O0):
<_OSSwapInt16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
xor    %esi,%esi
call   1030 <OSReadSwapInt16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_OSSwapInt16>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1030 <OSReadSwapInt16@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @_OSSwapInt16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @OSReadSwapInt16(i32* %2, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void dummy_func() {
  pthread_exit(NULL);
  return;
}


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

x86 assembly (clang, -O2):
<dummy_func>:
xor    %edi,%edi
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define void @dummy_func() {
%1 = call i32 @pthread_exit(i32* null)
ret void
}

LLVM IR (-O2):
define void @dummy_func() {
%1 = tail call i32 @pthread_exit(i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_putstr(char *);
int my_env(char **env, char **s) {
  int i;
  i = 0;
  (void)s;
  while (env[i] != NULL) {
    my_putstr(env[i]);
    my_putstr("\n");
    i = i + 1;
  }
  return (1);
}


x86 assembly (clang, -O0):
<my_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1165 <my_env+0x55>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <my_putstr@plt>
lea    0xeae(%rip),%rdi
call   1030 <my_putstr@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <my_env+0x17>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_env>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1149 <my_env+0x39>
add    $0x8,%rbx
lea    0xed6(%rip),%r14
nopw   0x0(%rax,%rax,1)
call   1030 <my_putstr@plt>
mov    %r14,%rdi
call   1030 <my_putstr@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <my_env+0x20>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i32 @my_env(i8** nocapture %0, i8** nocapture readnone %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = phi i8* [ %12, %5 ], [ %3, %2 ]
%8 = tail call i32 @my_putstr(i8* %7)
%9 = tail call i32 @my_putstr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %5
14: ; preds = %5, %2
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ allocate_enough_memory(unsigned int **, int *, int *);
void insert_value_in_array(unsigned int **ptr, int *nele, int *nele_alloc,
                           const unsigned int value, char *arrayname) {
  (void)arrayname;
  allocate_enough_memory(ptr, nele, nele_alloc);
  (*ptr)[(*nele) - 1] = value;
}


x86 assembly (clang, -O0):
<insert_value_in_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <allocate_enough_memory@plt>
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_value_in_array>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <allocate_enough_memory@plt>
mov    0x0(%rbp),%rax
movslq (%rbx),%rcx
mov    %r14d,-0x4(%rax,%rcx,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @insert_value_in_array(i32** %0, i32* %1, i32* %2, i32 %3, i8* %4) {
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
store i32** %0, i32*** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i8*, i8** %10
%12 = load i32**, i32*** %6
%13 = load i32*, i32** %7
%14 = load i32*, i32** %8
%15 = call i32 @allocate_enough_memory(i32** %12, i32* %13, i32* %14)
%16 = load i32, i32* %9
%17 = load i32**, i32*** %6
%18 = load i32*, i32** %17
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %18, i64 %22
store i32 %16, i32* %23
ret void
}

LLVM IR (-O2):
define void @insert_value_in_array(i32** %0, i32* %1, i32* %2, i32 %3, i8* nocapture readnone %4) {
%6 = tail call i32 @allocate_enough_memory(i32** %0, i32* %1, i32* %2)
%7 = load i32*, i32** %0
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %7, i64 %10
store i32 %3, i32* %11
ret void
}
/* Variables and functions */
int number_add_mod(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int a = 10;
  int b = 5;
  int c = 12;
  int x = number_add_mod(a, b, c);
  printf("(%d+%d)%%%d = %d\n", a, b, c, x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0xc,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <number_add_mod@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x5,%esi
mov    $0xc,%edx
call   1030 <number_add_mod@plt>
lea    0xec4(%rip),%rdi
mov    $0xa,%esi
mov    $0x5,%edx
mov    $0xc,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"(%d+%d)%%%d = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @number_add_mod(i32 10, i32 5, i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 10, i32 5, i32 12, i32 %1)
ret i32 0
}
int decisionFR(int numOfResp, int value) { return numOfResp % value == 0; }


x86 assembly (clang, -O0):
<decisionFR>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decisionFR>:
mov    %edi,%eax
cltd
idiv   %esi
xor    %eax,%eax
test   %edx,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @decisionFR(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 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @decisionFR(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
int test_imm_6Cint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x6C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Cint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x6c,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Cint64_highword_mem>:
testb  $0x6c,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_6Cint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 463856467968
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void atomic_hwfence() { __asm__ __volatile__("mfence" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @atomic_hwfence() {
tail call void asm sideeffect "mfence", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int in_addr_t;

/* Variables and functions */
in_addr_t set_bit(in_addr_t addr, int bitno, int val) {
  if (val)
    return (addr | (1 << (32 - bitno)));
  else
    return (addr & ~(1 << (32 - bitno)));
}


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1135 <set_bit+0x35>
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
sub    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <set_bit+0x51>
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
sub    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    $0x20,%cl
sub    %sil,%cl
mov    %edi,%eax
bts    %ecx,%eax
btr    %ecx,%edi
test   %edx,%edx
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @set_bit(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = sub nsw i32 32, %1
%6 = shl nuw i32 1, %5
%7 = or i32 %6, %0
%8 = xor i32 %6, -1
%9 = and i32 %8, %0
%10 = select i1 %4, i32 %9, i32 %7
ret i32 %10
}
/* Variables and functions */
int ilogbl(long double);
__attribute__((no)) int foo(long double x) { return ilogbl(x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <ilogbl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
jmp    1030 <ilogbl@plt>

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

LLVM IR (-O2):
define i32 @foo(x86_fp80 %0) {
%2 = tail call i32 @ilogbl(x86_fp80 %0)
ret i32 %2
}
/* Type definitions */
struct msgbuf {
  int dummy;
};
struct buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ buf_enqueue(struct msgbuf *, struct buf *);
void buf_close(struct msgbuf *msgbuf, struct buf *buf) {
  buf_enqueue(msgbuf, buf);
}


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

x86 assembly (clang, -O2):
<buf_close>:
jmp    1030 <buf_enqueue@plt>

LLVM IR (-O0):
%struct.msgbuf = type { i32 }
%struct.buf = type { i32 }
define void @buf_close(%struct.msgbuf* %0, %struct.buf* %1) {
%3 = alloca %struct.msgbuf*
%4 = alloca %struct.buf*
store %struct.msgbuf* %0, %struct.msgbuf** %3
store %struct.buf* %1, %struct.buf** %4
%5 = load %struct.msgbuf*, %struct.msgbuf** %3
%6 = load %struct.buf*, %struct.buf** %4
%7 = call i32 @buf_enqueue(%struct.msgbuf* %5, %struct.buf* %6)
ret void
}

LLVM IR (-O2):
%struct.msgbuf = type { i32 }
%struct.buf = type { i32 }
define void @buf_close(%struct.msgbuf* %0, %struct.buf* %1) {
%3 = tail call i32 @buf_enqueue(%struct.msgbuf* %0, %struct.buf* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          ""
          "./"
          "thc-ssl-dos"
          " [options] <ip> <port>\n"
          "  -h      help\n"
          "  -l <n>  Limit parallel connections [default: %d]\n"
          "",
          (400));
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    $0x190,%edx
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
mov    $0x190,%edx
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [103 x i8] c"./thc-ssl-dos [options] <ip> <port>\0A -h help\0A -l <n> Limit parallel connections [default: %d]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0), i32 400)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [103 x i8] c"./thc-ssl-dos [options] <ip> <port>\0A -h help\0A -l <n> Limit parallel connections [default: %d]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0), i32 400)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void del_str(void *str) { free(str); }


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

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

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

LLVM IR (-O2):
define void @del_str(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}