xunge/DecIR huggingface dataset:
__attribute__((no, noclone)) signed __int128 t102_2add(signed __int128 y) {
  signed __int128 x =
      (((signed __int128)(((unsigned __int128)1 << (16 * 8 - 1)) - 1)));
  signed __int128 r;
  if (__builtin_add_overflow(x, y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t102_2add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x38(%rbp)
movq   $0xffffffffffffffff,-0x40(%rbp)
ff
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rax
add    %rsi,%rdx
adc    %rax,%rcx
seto   %al
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x48(%rbp)
test   $0x1,%al
jne    1174 <t102_2add+0x64>
jmp    117b <t102_2add+0x6b>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t102_2add>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0xffffffffffffffff,%r14
movabs $0x7fffffffffffffff,%rbx
ff ff 7f
adc    %rsi,%rbx
jno    1131 <t102_2add+0x21>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %r14,%rax
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t102_2add(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i128 170141183460469231731687303715884105727, i128* %6
%12 = load i128, i128* %6
%13 = load i128, i128* %5
%14 = call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %12, i128 %13)
%15 = extractvalue { i128, i1 } %14, 1
%16 = extractvalue { i128, i1 } %14, 0
store i128 %16, i128* %7
br i1 %15, label %17, label %19
17: ; preds = %2
%18 = call i32 (...) @bar()
br label %19
19: ; preds = %17, %2
%20 = load i128, i128* %7
store i128 %20, i128* %3
%21 = bitcast i128* %3 to { i64, i64 }*
%22 = load { i64, i64 }, { i64, i64 }* %21
ret { i64, i64 } %22
}

LLVM IR (-O2):
define { i64, i64 } @t102_2add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %6, i128 170141183460469231731687303715884105727)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
int bob_mcbob();
int main(void) { return bob_mcbob(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bob_mcbob@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @bob_mcbob()
ret i32 %2
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bob_mcbob()
ret i32 %1
}
void init_bsp_tree() { ; }


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

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

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

LLVM IR (-O2):
define void @init_bsp_tree() {
ret void
}
unsigned char f64(unsigned char x, long int y) {
  return (x << ((-y) & (8 * sizeof(unsigned char) - 1))) ^ (x >> y);
}


x86 assembly (clang, -O0):
<f64>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0x7,%rcx
shl    %cl,%eax
movzbl -0x1(%rbp),%edx
mov    -0x10(%rbp),%rcx
sar    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f64>:
mov    %esi,%ecx
neg    %cl
and    $0x7,%cl
mov    %edi,%eax
shl    %cl,%eax
mov    %esi,%ecx
shr    %cl,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f64(i8 zeroext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i64, i64* %4
%8 = sub nsw i64 0, %7
%9 = and i64 %8, 7
%10 = trunc i64 %9 to i32
%11 = shl i32 %6, %10
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = load i64, i64* %4
%15 = trunc i64 %14 to i32
%16 = ashr i32 %13, %15
%17 = xor i32 %11, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @f64(i8 zeroext %0, i64 %1) {
%3 = zext i8 %0 to i32
%4 = trunc i64 %1 to i32
%5 = sub i32 0, %4
%6 = and i32 %5, 7
%7 = shl nuw nsw i32 %3, %6
%8 = lshr i32 %3, %4
%9 = xor i32 %7, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}
/* Type definitions */
struct tms {
  double tms_utime;
  double tms_stime;
};

/* Variables and functions */
int /*<<< orphan*/ times(struct tms *);
void atim_(double *cpu, double *wall) {
  struct tms buf;
  times(&buf);
  *cpu = buf.tms_utime / 100.0;
  *wall = *cpu + buf.tms_stime / 100.0;
}


x86 assembly (clang, -O0):
<atim_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <times@plt>
movsd  -0x20(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xea9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atim_>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
call   1030 <times@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xecb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
movsd  0x10(%rsp),%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tms = type { double, double }
define void @atim_(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca %struct.tms
store double* %0, double** %3
store double* %1, double** %4
%6 = call i32 @times(%struct.tms* %5)
%7 = getelementptr inbounds %struct.tms, %struct.tms* %5, i32 0, i32 0
%8 = load double, double* %7
%9 = fdiv double %8, 1.000000e+02
%10 = load double*, double** %3
store double %9, double* %10
%11 = load double*, double** %3
%12 = load double, double* %11
%13 = getelementptr inbounds %struct.tms, %struct.tms* %5, i32 0, i32 1
%14 = load double, double* %13
%15 = fdiv double %14, 1.000000e+02
%16 = fadd double %12, %15
%17 = load double*, double** %4
store double %16, double* %17
ret void
}

LLVM IR (-O2):
%struct.tms = type { double, double }
define void @atim_(double* nocapture writeonly %0, double* nocapture writeonly %1) {
%3 = alloca %struct.tms
%4 = bitcast %struct.tms* %3 to i8*
%5 = call i32 @times(%struct.tms* %3)
%6 = getelementptr inbounds %struct.tms, %struct.tms* %3, i64 0, i32 0
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+02
store double %8, double* %0
%9 = getelementptr inbounds %struct.tms, %struct.tms* %3, i64 0, i32 1
%10 = load double, double* %9
%11 = fdiv double %10, 1.000000e+02
%12 = fadd double %8, %11
store double %12, double* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ test_definitions();
int /*<<< orphan*/ test_feclearexcept();
int /*<<< orphan*/ test_fegetround_fesetround();
int /*<<< orphan*/ test_feraiseexcept();
int /*<<< orphan*/ test_fetestexcept();
void run_fenv_tests() {
  printf("\nRunning Test Case: %s\n", "Test POSIX fenv.h functions");
  ;
  test_definitions();
  test_feclearexcept();
  test_fetestexcept();
  test_feraiseexcept();
  test_fegetround_fesetround();
}


x86 assembly (clang, -O0):
<run_fenv_tests>:
push   %rbp
mov    %rsp,%rbp
lea    0xe95(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <test_definitions@plt>
mov    $0x0,%al
call   1040 <test_feclearexcept@plt>
mov    $0x0,%al
call   1070 <test_fetestexcept@plt>
mov    $0x0,%al
call   1080 <test_feraiseexcept@plt>
mov    $0x0,%al
call   1030 <test_fegetround_fesetround@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_fenv_tests>:
push   %rax
lea    0xe98(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <test_definitions@plt>
xor    %eax,%eax
call   1040 <test_feclearexcept@plt>
xor    %eax,%eax
call   1070 <test_fetestexcept@plt>
xor    %eax,%eax
call   1080 <test_feraiseexcept@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_fegetround_fesetround@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0ARunning Test Case: %s\0A\00"
@.str.1 = [28 x i8] c"Test POSIX fenv.h functions\00"
define void @run_fenv_tests() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (...) @test_definitions()
%3 = call i32 (...) @test_feclearexcept()
%4 = call i32 (...) @test_fetestexcept()
%5 = call i32 (...) @test_feraiseexcept()
%6 = call i32 (...) @test_fegetround_fesetround()
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0ARunning Test Case: %s\0A\00"
@.str.1 = [28 x i8] c"Test POSIX fenv.h functions\00"
define void @run_fenv_tests() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @test_definitions()
%3 = tail call i32 (...) @test_feclearexcept()
%4 = tail call i32 (...) @test_fetestexcept()
%5 = tail call i32 (...) @test_feraiseexcept()
%6 = tail call i32 (...) @test_fegetround_fesetround()
ret void
}
/* Variables and functions */
int xml_main(int, char **);
int main(int argc, char **argv) { return xml_main(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <xml_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <xml_main@plt>

LLVM IR (-O0):
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 i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @xml_main(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @xml_main(i32 %0, i8** %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void decrypt(char *buffer, int bufferSize) { FILE *file; }


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

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

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

LLVM IR (-O2):
define void @decrypt(i8* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
struct cfg_section {
  int dummy;
};
struct cfg_entry {
  int dummy;
};

/* Variables and functions */
struct cfg_entry *cfg_find_entry(struct cfg_section *, char *);
struct cfg_section *cfg_get_sec(char *, char *);
struct cfg_entry *cfg_get_ent(char *dname, char *sname, char *ename) {
  struct cfg_section *section;
  section = cfg_get_sec(dname, sname);
  if (NULL == section)
    return NULL;
  return cfg_find_entry(section, ename);
}


x86 assembly (clang, -O0):
<cfg_get_ent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <cfg_get_sec@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%rax
jne    115e <cfg_get_ent+0x3e>
movq   $0x0,-0x8(%rbp)
jmp    116f <cfg_get_ent+0x4f>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <cfg_find_entry@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfg_get_ent>:
push   %rbx
mov    %rdx,%rbx
call   1030 <cfg_get_sec@plt>
test   %rax,%rax
je     113a <cfg_get_ent+0x1a>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <cfg_find_entry@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.cfg_entry = type { i32 }
%struct.cfg_section = type { i32 }
define %struct.cfg_entry* @cfg_get_ent(i8* %0, i8* %1, i8* %2) {
%4 = alloca %struct.cfg_entry*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.cfg_section*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call %struct.cfg_section* @cfg_get_sec(i8* %9, i8* %10)
store %struct.cfg_section* %11, %struct.cfg_section** %8
%12 = load %struct.cfg_section*, %struct.cfg_section** %8
%13 = icmp eq %struct.cfg_section* null, %12
br i1 %13, label %14, label %15
14: ; preds = %3
store %struct.cfg_entry* null, %struct.cfg_entry** %4
br label %19
15: ; preds = %3
%16 = load %struct.cfg_section*, %struct.cfg_section** %8
%17 = load i8*, i8** %7
%18 = call %struct.cfg_entry* @cfg_find_entry(%struct.cfg_section* %16, i8* %17)
store %struct.cfg_entry* %18, %struct.cfg_entry** %4
br label %19
19: ; preds = %15, %14
%20 = load %struct.cfg_entry*, %struct.cfg_entry** %4
ret %struct.cfg_entry* %20
}

LLVM IR (-O2):
%struct.cfg_entry = type { i32 }
%struct.cfg_section = type { i32 }
define %struct.cfg_entry* @cfg_get_ent(i8* %0, i8* %1, i8* %2) {
%4 = tail call %struct.cfg_section* @cfg_get_sec(i8* %0, i8* %1)
%5 = icmp eq %struct.cfg_section* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call %struct.cfg_entry* @cfg_find_entry(%struct.cfg_section* %4, i8* %2)
br label %8
8: ; preds = %3, %6
%9 = phi %struct.cfg_entry* [ %7, %6 ], [ null, %3 ]
ret %struct.cfg_entry* %9
}
/* Variables and functions */
int /*<<< orphan*/ _expect_never(char *, char *, int);
int /*<<< orphan*/ mixed_parameters(int, char *);
void unexpected_call_should_throw_error() {
  _expect_never("mixed_parameters",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/jedediah/gospel/refs/heads/"
                "master/cgreen/samples/sample.c",
                171);
  mixed_parameters(10, "Helloo");
}


x86 assembly (clang, -O0):
<unexpected_call_should_throw_error>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0xab,%edx
call   1030 <_expect_never@plt>
mov    $0xa,%edi
lea    0xf5d(%rip),%rsi
call   1040 <mixed_parameters@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unexpected_call_should_throw_error>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xee2(%rip),%rsi
mov    $0xab,%edx
call   1030 <_expect_never@plt>
lea    0xf65(%rip),%rsi
mov    $0xa,%edi
pop    %rax
jmp    1040 <mixed_parameters@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"mixed_parameters\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jedediah/gospel/refs/heads/master/cgreen/samples/sample.c\00"
@.str.2 = [7 x i8] c"Helloo\00"
define void @unexpected_call_should_throw_error() {
%1 = call i32 @_expect_never(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 171)
%2 = call i32 @mixed_parameters(i32 10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"mixed_parameters\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jedediah/gospel/refs/heads/master/cgreen/samples/sample.c\00"
@.str.2 = [7 x i8] c"Helloo\00"
define void @unexpected_call_should_throw_error() {
%1 = tail call i32 @_expect_never(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 171)
%2 = tail call i32 @mixed_parameters(i32 10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret void
}
int test_imm_B6uint32_reg(unsigned int val) {
  return ((val) & (0xB6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B6uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xb6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_B6uint32_reg(i32 %0) {
%2 = and i32 %0, 182
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ __ISR_DELAY();
void SysTickHandler(void) { __ISR_DELAY(); }


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

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

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

LLVM IR (-O2):
define void @SysTickHandler() {
%1 = tail call i32 (...) @__ISR_DELAY()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int fchmod(int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int testfchmod(int fd, mode_t mode) {
  int ret = fchmod(fd, mode);
  if (ret)
    perror("fchmod");
  return ret;
}


x86 assembly (clang, -O0):
<testfchmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <fchmod@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1152 <testfchmod+0x32>
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfchmod>:
push   %rbx
call   1030 <fchmod@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1130 <testfchmod+0x10>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec9(%rip),%rdi
call   1040 <perror@plt>
jmp    112c <testfchmod+0xc>

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

LLVM IR (-O2):
@.str = [7 x i8] c"fchmod\00"
define i32 @testfchmod(i32 %0, i32 %1) {
%3 = tail call i32 @fchmod(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int plinth_stdout_putc(int c) { return fputc(c, stdout); }


x86 assembly (clang, -O0):
<plinth_stdout_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plinth_stdout_putc>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stdout = global i32 0
define i32 @plinth_stdout_putc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @stdout
%5 = call i32 @fputc(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @plinth_stdout_putc(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputc(i32 %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void func2() {
  int i;
  int j;
  printf("0x%x 0x%x\n", i, j);
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"0x%x 0x%x\0A\00"
define void @func2() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 undef, i32 undef)
ret void
}
__attribute__((const)) int is_po2(unsigned x) { return (x & (x - 1)) == 0; }


x86 assembly (clang, -O0):
<is_po2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_po2>:
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_po2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub i32 %4, 1
%6 = and i32 %3, %5
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_po2(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp ult i32 %2, 2
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("The first git commit..\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>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"The first git commit..\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [23 x i8] c"The first git commit..\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int gen_register(int vp, int size, int typ) { return -1; }


x86 assembly (clang, -O0):
<gen_register>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @gen_register(i32 %0, i32 %1, i32 %2) {
ret i32 -1
}
int isASCII(unsigned char c) { return c < 128; }


x86 assembly (clang, -O0):
<isASCII>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x80,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isASCII>:
not    %dil
shr    $0x7,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @isASCII(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp slt i32 %4, 128
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isASCII(i8 zeroext %0) {
%2 = xor i8 %0, -1
%3 = lshr i8 %2, 7
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int is_HVM_done();
void wait_HVM() {
  while (is_HVM_done() != 1)
    ;
  return;
}


x86 assembly (clang, -O0):
<wait_HVM>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <wait_HVM+0x9>
mov    $0x0,%al
call   1030 <is_HVM_done@plt>
cmp    $0x1,%eax
je     112e <wait_HVM+0x1e>
jmp    1119 <wait_HVM+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_HVM>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <is_HVM_done@plt>
cmp    $0x1,%eax
jne    1120 <wait_HVM+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @wait_HVM() {
br label %1
1: ; preds = %4, %0
%2 = call i32 (...) @is_HVM_done()
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %5
4: ; preds = %1
br label %1
5: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @wait_HVM() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @is_HVM_done()
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
int compute_hex_width(unsigned int value) {
  int width = 0;
  do {
    width++;
    value >>= 4;
  } while (value);
  return width;
}


x86 assembly (clang, -O0):
<compute_hex_width>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    110e <compute_hex_width+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_hex_width>:
xor    %eax,%eax
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
shr    $0x4,%ecx
cmp    $0xf,%edi
mov    %ecx,%edi
ja     1110 <compute_hex_width+0x10>
ret

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

LLVM IR (-O2):
define i32 @compute_hex_width(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = phi i32 [ 0, %1 ], [ %5, %2 ]
%5 = add nuw nsw i32 %4, 1
%6 = lshr i32 %3, 4
%7 = icmp ult i32 %3, 16
br i1 %7, label %8, label %2
8: ; preds = %2
ret i32 %5
}
double rad(double x) {
  double pi = 3.141592, deg, min;
  deg = (int)x;
  min = x - deg;
  return pi * (deg + 5.0 * min / 3.0) / 180.0;
}


x86 assembly (clang, -O0):
<rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xf07(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xecb(%rip),%xmm2
mulsd  -0x20(%rbp),%xmm2
movsd  0xeb6(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad>:
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
mulsd  0xeec(%rip),%xmm0
divsd  0xeec(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xee8(%rip),%xmm0
divsd  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @rad(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
store double 0x400921FAFC8B007A, double* %3
%6 = load double, double* %2
%7 = fptosi double %6 to i32
%8 = sitofp i32 %7 to double
store double %8, double* %4
%9 = load double, double* %2
%10 = load double, double* %4
%11 = fsub double %9, %10
store double %11, double* %5
%12 = load double, double* %3
%13 = load double, double* %4
%14 = load double, double* %5
%15 = fmul double 5.000000e+00, %14
%16 = fdiv double %15, 3.000000e+00
%17 = fadd double %13, %16
%18 = fmul double %12, %17
%19 = fdiv double %18, 1.800000e+02
ret double %19
}

LLVM IR (-O2):
define double @rad(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to double
%4 = fsub double %0, %3
%5 = fmul double %4, 5.000000e+00
%6 = fdiv double %5, 3.000000e+00
%7 = fadd double %6, %3
%8 = fmul double %7, 0x400921FAFC8B007A
%9 = fdiv double %8, 1.800000e+02
ret double %9
}
/* Type definitions */
struct xfs_inode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ xfs_iflags_test_and_set(struct xfs_inode *, int);
int xfs_iflock_nowait(struct xfs_inode *ip) {
  return !xfs_iflags_test_and_set(ip, (1 << 7));
}


x86 assembly (clang, -O0):
<xfs_iflock_nowait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x80,%esi
call   1030 <xfs_iflags_test_and_set@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfs_iflock_nowait>:
push   %rax
mov    $0x80,%esi
call   1030 <xfs_iflags_test_and_set@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.xfs_inode = type { i32 }
define i32 @xfs_iflock_nowait(%struct.xfs_inode* %0) {
%2 = alloca %struct.xfs_inode*
store %struct.xfs_inode* %0, %struct.xfs_inode** %2
%3 = load %struct.xfs_inode*, %struct.xfs_inode** %2
%4 = call i32 @xfs_iflags_test_and_set(%struct.xfs_inode* %3, i32 128)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.xfs_inode = type { i32 }
define i32 @xfs_iflock_nowait(%struct.xfs_inode* %0) {
%2 = tail call i32 @xfs_iflags_test_and_set(%struct.xfs_inode* %0, i32 128)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Hello!\n");
  int a = 1, b = 2;
  printf("The sum of a and b is %i\n", a + b);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Hello!\0A\00"
@.str.1 = [26 x i8] c"The sum of a and b is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
store i32 2, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"The sum of a and b is %i\0A\00"
@str = [7 x i8] c"Hello!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret i32 0
}
char *str_skip_to_whitespace(char *str) {
  while (*str && (*str != ' ' && *str != '\t' && *str != '\n'))
    str++;
  return str;
}


x86 assembly (clang, -O0):
<str_skip_to_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     115d <str_skip_to_whitespace+0x5d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0xa(%rbp)
je     1157 <str_skip_to_whitespace+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0xa(%rbp)
je     1157 <str_skip_to_whitespace+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    116d <str_skip_to_whitespace+0x6d>
jmp    117e <str_skip_to_whitespace+0x7e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <str_skip_to_whitespace+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_skip_to_whitespace>:
mov    %rdi,%rax
movabs $0x100000601,%rcx
jmp    1114 <str_skip_to_whitespace+0x14>
nop
add    $0x1,%rax
movzbl (%rax),%edx
cmp    $0x20,%rdx
ja     1110 <str_skip_to_whitespace+0x10>
bt     %rdx,%rcx
jae    1110 <str_skip_to_whitespace+0x10>
ret

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

LLVM IR (-O2):
define i8* @str_skip_to_whitespace(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 32, label %7
i8 9, label %7
i8 10, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2, %2, %2
ret i8* %3
}
/* Variables and functions */
int inb(int);
void mach_countup(unsigned long *count_p) {
  unsigned long count = 0;
  do {
    count++;
  } while ((inb(0x61) & 0x20) == 0);
  *count_p = count;
}


x86 assembly (clang, -O0):
<mach_countup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    $0x61,%edi
call   1030 <inb@plt>
and    $0x20,%eax
cmp    $0x0,%eax
je     1124 <mach_countup+0x14>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mach_countup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
add    $0x1,%rbx
mov    $0x61,%edi
call   1030 <inb@plt>
test   $0x20,%al
je     1120 <mach_countup+0x10>
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @mach_countup(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
store i64 0, i64* %3
br label %4
4: ; preds = %7, %1
%5 = load i64, i64* %3
%6 = add i64 %5, 1
store i64 %6, i64* %3
br label %7
7: ; preds = %4
%8 = call i32 @inb(i32 97)
%9 = and i32 %8, 32
%10 = icmp eq i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %7
%12 = load i64, i64* %3
%13 = load i64*, i64** %2
store i64 %12, i64* %13
ret void
}

LLVM IR (-O2):
define void @mach_countup(i64* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %4, %2 ]
%4 = add i64 %3, 1
%5 = tail call i32 @inb(i32 97)
%6 = and i32 %5, 32
%7 = icmp eq i32 %6, 0
br i1 %7, label %2, label %8
8: ; preds = %2
store i64 %4, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_arm_dmb(int);
int /*<<< orphan*/ __builtin_arm_dsb(int);
int /*<<< orphan*/ __builtin_arm_isb(int);
void test_barrier() {
  __builtin_arm_dmb(1);
  __builtin_arm_dsb(2);
  __builtin_arm_isb(3);
}


x86 assembly (clang, -O0):
<test_barrier>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1050 <__builtin_arm_dmb@plt>
mov    $0x2,%edi
call   1040 <__builtin_arm_dsb@plt>
mov    $0x3,%edi
call   1030 <__builtin_arm_isb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_barrier>:
push   %rax
mov    $0x1,%edi
call   1050 <__builtin_arm_dmb@plt>
mov    $0x2,%edi
call   1040 <__builtin_arm_dsb@plt>
mov    $0x3,%edi
pop    %rax
jmp    1030 <__builtin_arm_isb@plt>

LLVM IR (-O0):
define void @test_barrier() {
%1 = call i32 @__builtin_arm_dmb(i32 1)
%2 = call i32 @__builtin_arm_dsb(i32 2)
%3 = call i32 @__builtin_arm_isb(i32 3)
ret void
}

LLVM IR (-O2):
define void @test_barrier() {
%1 = tail call i32 @__builtin_arm_dmb(i32 1)
%2 = tail call i32 @__builtin_arm_dsb(i32 2)
%3 = tail call i32 @__builtin_arm_isb(i32 3)
ret void
}
void destroyBuilding() {}


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

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

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

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

/* Variables and functions */
int mkdir(char const *, int /*<<< orphan*/);
int octave_mkdir_wrapper(const char *name, mode_t mode) {
  return mkdir(name, mode);
}


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

x86 assembly (clang, -O2):
<octave_mkdir_wrapper>:
jmp    1030 <mkdir@plt>

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

LLVM IR (-O2):
define i32 @octave_mkdir_wrapper(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @mkdir(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ normalCDeclaration1();
void normalCDeclaration2() { normalCDeclaration1(); }


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

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

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

LLVM IR (-O2):
define void @normalCDeclaration2() {
%1 = tail call i32 (...) @normalCDeclaration1()
ret void
}
/* Variables and functions */
int strlen(const char *p) {
  const char *q = p;
  while (*q)
    q++;
  return q - p;
}


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

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
size_t __attribute__((weak)) strnlen(const char *s, size_t max_len) {
  size_t i = 0;
  for (; (i < max_len) && s[i]; ++i)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    113c <strnlen+0x3c>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    114c <strnlen+0x4c>
jmp    1162 <strnlen+0x62>
jmp    1151 <strnlen+0x51>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strnlen+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
xor    %eax,%eax
test   %rsi,%rsi
je     1122 <strnlen+0x22>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rax,1)
je     1122 <strnlen+0x22>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <strnlen+0x10>
mov    %rsi,%rax
ret

LLVM IR (-O0):
define weak i64 @strnlen(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %20, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br label %17
17: ; preds = %10, %6
%18 = phi i1 [ false, %6 ], [ %16, %10 ]
br i1 %18, label %19, label %23
19: ; preds = %17
br label %20
20: ; preds = %19
%21 = load i64, i64* %5
%22 = add i64 %21, 1
store i64 %22, i64* %5
br label %6
23: ; preds = %17
%24 = load i64, i64* %5
ret i64 %24
}

LLVM IR (-O2):
define weak i64 @strnlen(i8* %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %9
%5 = phi i64 [ %10, %9 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %9, %2
%13 = phi i64 [ 0, %2 ], [ %1, %9 ], [ %5, %4 ]
ret i64 %13
}
int getchar() {
  while (!((*(volatile unsigned char *)0x0071) & 0x10)) {
  }
  char ch = (*(volatile unsigned char *)0x0075);
  (*(volatile unsigned char *)0x0071) = 0x10;
  return ch;
}


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
mov    $0x71,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x10,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1126 <getchar+0x26>
jmp    112b <getchar+0x2b>
jmp    1104 <getchar+0x4>
mov    $0x75,%eax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
mov    $0x71,%eax
movb   $0x10,(%rax)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
testb  $0x10,0x71
10
je     1100 <getchar>
movsbl 0x75,%eax
movb   $0x10,0x71
10
ret

LLVM IR (-O0):
define i32 @getchar() {
%1 = alloca i8
br label %2
2: ; preds = %8, %0
%3 = load volatile i8, i8* inttoptr (i64 113 to i8*)
%4 = zext i8 %3 to i32
%5 = and i32 %4, 16
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %2
br label %2
9: ; preds = %2
%10 = load volatile i8, i8* inttoptr (i64 117 to i8*)
store i8 %10, i8* %1
store volatile i8 16, i8* inttoptr (i64 113 to i8*)
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @getchar() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i8, i8* inttoptr (i64 113 to i8*)
%3 = and i8 %2, 16
%4 = icmp eq i8 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = load volatile i8, i8* inttoptr (i64 117 to i8*)
store volatile i8 16, i8* inttoptr (i64 113 to i8*)
%7 = sext i8 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ set_var(char const *, char *);
void cmd_let(const char *assign_to, char *arg) { set_var(assign_to, arg); }


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

x86 assembly (clang, -O2):
<cmd_let>:
jmp    1030 <set_var@plt>

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

LLVM IR (-O2):
define void @cmd_let(i8* %0, i8* %1) {
%3 = tail call i32 @set_var(i8* %0, i8* %1)
ret void
}
int main(void) {
  int a = 8;
  int s = 5;
#pragma acc parallel vector_length(N) copy(s)
  {
    int i;
#pragma acc loop reduction(+ : s)
    for (i = 0; i < 32; ++i)
      s += a;
  }
  if (s != 5 + 32 * 8)
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x20,-0x10(%rbp)
jge    1155 <main+0x45>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <main+0x24>
cmpl   $0x105,-0xc(%rbp)
je     1167 <main+0x57>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %2
store i32 5, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 32
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, %9
store i32 %11, i32* %3
br label %12
12: ; preds = %8
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %5
15: ; preds = %5
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 261
br i1 %17, label %18, label %19
18: ; preds = %15
unreachable
19: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bye2(void) {
  printf("2-- prepping\n");
  printf("2-- That was all, folks\n");
}


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

x86 assembly (clang, -O2):
<bye2>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"2-- prepping\0A\00"
@.str.1 = [25 x i8] c"2-- That was all, folks\0A\00"
define void @bye2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"2-- prepping\00"
@str.2 = [24 x i8] c"2-- That was all, folks\00"
define void @bye2() {
%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 ([24 x i8], [24 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int exit(int status) {}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
unreachable
}

LLVM IR (-O2):