xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ le_sudoku(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  FILE *arq;
  arq = fopen("sudoku.txt", "r");
  if (arq == NULL) {
    printf("arquivo não encontrado");
    return 0;
  }
  le_sudoku(arq);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1179 <main+0x49>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1189 <main+0x59>
mov    -0x10(%rbp),%rdi
call   1040 <le_sudoku@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1153 <main+0x23>
mov    %rax,%rdi
call   1040 <le_sudoku@plt>
jmp    115f <main+0x2f>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"sudoku.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"arquivo n\C3\A3o encontrado\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %11
8: ; preds = %0
%9 = load i32*, i32** %2
%10 = call i32 @le_sudoku(i32* %9)
store i32 0, i32* %1
br label %11
11: ; preds = %8, %6
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [11 x i8] c"sudoku.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"arquivo n\C3\A3o encontrado\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 @le_sudoku(i32* %1)
br label %7
7: ; preds = %5, %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ writeUART(int, unsigned char *);
void fan_set_speed(char cSpeed) {
  unsigned char ucSpdDemand[3] = {'\x001', '\x033', ' '};
  ucSpdDemand[2] = cSpeed - 1;
  writeUART(3, ucSpdDemand);
}


x86 assembly (clang, -O0):
<fan_set_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0xedb(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0xed3(%rip),%al
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x2(%rbp)
lea    -0x4(%rbp),%rsi
mov    $0x3,%edi
call   1030 <writeUART@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fan_set_speed>:
push   %rax
movw   $0x3301,0x4(%rsp)
add    $0xff,%dil
mov    %dil,0x6(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x3,%edi
call   1030 <writeUART@plt>
pop    %rax
ret

LLVM IR (-O0):
@__const.fan_set_speed.ucSpdDemand = [3 x i8] c"\013 "
define void @fan_set_speed(i8 signext %0) {
%2 = alloca i8
%3 = alloca [3 x i8]
store i8 %0, i8* %2
%4 = bitcast [3 x i8]* %3 to i8*
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 1
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 %8, i8* %9
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%11 = call i32 @writeUART(i32 3, i8* %10)
ret void
}

LLVM IR (-O2):
define void @fan_set_speed(i8 signext %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = bitcast [3 x i8]* %2 to i16*
store i16 13057, i16* %4
%5 = add i8 %0, -1
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 %5, i8* %6
%7 = call i32 @writeUART(i32 3, i8* %3)
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int padcon_quaddobl_initialize_parameter_homotopy(int idx, int verbose) {
  int fail;
  int precision = 2;
  int pars[2];
  double *c;
  pars[0] = idx;
  pars[1] = verbose;
  fail = _ada_use_c2phc4c(878, &precision, pars, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<padcon_quaddobl_initialize_parameter_homotopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x36e,%edi
lea    -0x10(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padcon_quaddobl_initialize_parameter_homotopy>:
sub    $0x18,%rsp
movl   $0x2,0xc(%rsp)
mov    %edi,0x10(%rsp)
mov    %esi,0x14(%rsp)
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    $0x36e,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @padcon_quaddobl_initialize_parameter_homotopy(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
%8 = alloca double*
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 2, i32* %6
%9 = load i32, i32* %3
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %9, i32* %10
%11 = load i32, i32* %4
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %11, i32* %12
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%14 = load double*, double** %8
%15 = call i32 @_ada_use_c2phc4c(i32 878, i32* %6, i32* %13, double* %14, i32 0)
store i32 %15, i32* %5
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
define i32 @padcon_quaddobl_initialize_parameter_homotopy(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
%5 = bitcast i32* %3 to i8*
store i32 2, i32* %3
%6 = bitcast [2 x i32]* %4 to i8*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 %0, i32* %7
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %1, i32* %8
%9 = call i32 @_ada_use_c2phc4c(i32 878, i32* %3, i32* %7, double* undef, i32 0)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Roomy_log(char *);
int /*<<< orphan*/ exit(int);
void RoomyArray_defaultUpdateFunc(unsigned long long int i, void *oldVal,
                                  void *updateVal, void *newValOut) {
  Roomy_log("ERROR: RoomyArray_defaultUpdateFunc called\n");
  exit(1);
}


x86 assembly (clang, -O0):
<RoomyArray_defaultUpdateFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xec1(%rip),%rdi
call   1030 <Roomy_log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<RoomyArray_defaultUpdateFunc>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <Roomy_log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"ERROR: RoomyArray_defaultUpdateFunc called\0A\00"
define void @RoomyArray_defaultUpdateFunc(i64 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i64 %0, i64* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = call i32 @Roomy_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [44 x i8] c"ERROR: RoomyArray_defaultUpdateFunc called\0A\00"
define void @RoomyArray_defaultUpdateFunc(i64 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = tail call i32 @Roomy_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *accept_input();
int /*<<< orphan*/ free(char *);
int handle_input(char *);
int /*<<< orphan*/ inform_user();
int /*<<< orphan*/ initialize_locs();
int /*<<< orphan*/ move_ogre();
int /*<<< orphan*/ welcome_user();
int main() {
  char *input;
  int i = 0;
  welcome_user();
  initialize_locs();
  while (i == 0) {
    inform_user();
    input = accept_input();
    i = handle_input(input);
    free(input);
    move_ogre();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <welcome_user@plt>
mov    $0x0,%al
call   1080 <initialize_locs@plt>
cmpl   $0x0,-0x14(%rbp)
jne    11d1 <main+0x61>
mov    $0x0,%al
call   1090 <inform_user@plt>
mov    $0x0,%al
call   1070 <accept_input@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <handle_input@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
mov    $0x0,%al
call   1050 <move_ogre@plt>
jmp    1194 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <welcome_user@plt>
xor    %eax,%eax
call   1080 <initialize_locs@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <inform_user@plt>
xor    %eax,%eax
call   1070 <accept_input@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <handle_input@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
call   1050 <move_ogre@plt>
test   %ebp,%ebp
je     1190 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (...) @welcome_user()
%5 = call i32 (...) @initialize_locs()
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = call i32 (...) @inform_user()
%11 = call i8* (...) @accept_input()
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @handle_input(i8* %12)
store i32 %13, i32* %3
%14 = load i8*, i8** %2
%15 = call i32 @free(i8* %14)
%16 = call i32 (...) @move_ogre()
br label %6
17: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @welcome_user()
%2 = tail call i32 (...) @initialize_locs()
br label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @inform_user()
%5 = tail call i8* (...) @accept_input()
%6 = tail call i32 @handle_input(i8* %5)
%7 = tail call i32 @free(i8* %5)
%8 = tail call i32 (...) @move_ogre()
%9 = icmp eq i32 %6, 0
br i1 %9, label %3, label %10
10: ; preds = %3
ret i32 0
}
int test_imm_A4int8_mem(signed char *val) {
  return ((*val) & (-0xA4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A4int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff5c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A4int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff5c,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A4int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -164
%7 = icmp ne i32 %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_A4int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -164
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ cson_value_is_builtin(void *);
int /*<<< orphan*/ free(void *);
void cson_free(void *p, char const *descr) {
  if (!cson_value_is_builtin(p)) {
    free(p);
  }
}


x86 assembly (clang, -O0):
<cson_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cson_value_is_builtin@plt>
cmp    $0x0,%eax
jne    114b <cson_free+0x2b>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cson_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <cson_value_is_builtin@plt>
test   %eax,%eax
je     112f <cson_free+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @cson_free(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 = call i32 @cson_value_is_builtin(i8* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
br label %11
11: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @cson_free(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @cson_value_is_builtin(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @free(i8* %0)
br label %7
7: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
int wip_pwm_validate_map(volatile uint32_t *ptr) {
  if (((uint32_t *)-1 == ptr) || (NULL == ptr)) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<wip_pwm_validate_map>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    -0x10(%rbp),%rax
je     1125 <wip_pwm_validate_map+0x25>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1131 <wip_pwm_validate_map+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1138 <wip_pwm_validate_map+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wip_pwm_validate_map>:
cmp    $0xffffffffffffffff,%rdi
sete   %al
test   %rdi,%rdi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
neg    %eax
ret

LLVM IR (-O0):
define i32 @wip_pwm_validate_map(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp eq i32* inttoptr (i64 -1 to i32*), %4
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32*, i32** %3
%8 = icmp eq i32* null, %7
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i32 -1, i32* %2
br label %11
10: ; preds = %6
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @wip_pwm_validate_map(i32* %0) {
%2 = icmp eq i32* %0, inttoptr (i64 -1 to i32*)
%3 = icmp eq i32* %0, null
%4 = or i1 %2, %3
%5 = sext i1 %4 to i32
ret i32 %5
}
void swap(int v[], int i, int j) {
  int temp;
  temp = v[i];
  v[i] = v[j];
  v[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
void native_func() {}


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

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

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

LLVM IR (-O2):
define void @native_func() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int system(char const *);
int system_sh(const char *cmd) {
  if (!cmd || !strlen(cmd))
    return -1;
  return system(cmd);
}


x86 assembly (clang, -O0):
<system_sh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <system_sh+0x29>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jne    1155 <system_sh+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1161 <system_sh+0x41>
mov    -0x10(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_sh>:
push   %rbx
test   %rdi,%rdi
je     113b <system_sh+0x1b>
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
je     113b <system_sh+0x1b>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <system@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @system_sh(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @system(i8* %0)
br label %8
8: ; preds = %1, %3, %6
%9 = phi i32 [ %7, %6 ], [ -1, %3 ], [ -1, %1 ]
ret i32 %9
}
void foo128() {}


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

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

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

LLVM IR (-O2):
define void @foo128() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FLSv2MBusGPIO_sendMBus8bit(int, int);
void FLSv2MBusGPIO_wakeup() { FLSv2MBusGPIO_sendMBus8bit(0x01, 0x10000000); }


x86 assembly (clang, -O0):
<FLSv2MBusGPIO_wakeup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x10000000,%esi
call   1030 <FLSv2MBusGPIO_sendMBus8bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<FLSv2MBusGPIO_wakeup>:
mov    $0x1,%edi
mov    $0x10000000,%esi
jmp    1030 <FLSv2MBusGPIO_sendMBus8bit@plt>

LLVM IR (-O0):
define void @FLSv2MBusGPIO_wakeup() {
%1 = call i32 @FLSv2MBusGPIO_sendMBus8bit(i32 1, i32 268435456)
ret void
}

LLVM IR (-O2):
define void @FLSv2MBusGPIO_wakeup() {
%1 = tail call i32 @FLSv2MBusGPIO_sendMBus8bit(i32 1, i32 268435456)
ret void
}
/* Type definitions */
struct address {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ socket_address_init(struct address *, char *,
                                       int /*<<< orphan*/, int);
int socket_parse(char *, int /*<<< orphan*/ *);
int socket_parse_addr(char *addr, struct address *address) {
  ssize_t len;
  int port = socket_parse(addr, &len);
  if (port == -1)
    return -1;
  socket_address_init(address, addr, len, port);
  return port;
}


x86 assembly (clang, -O0):
<socket_parse_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <socket_parse@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1156 <socket_parse_addr+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    116f <socket_parse_addr+0x4f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <socket_address_init@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_parse_addr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xc(%rsp),%rsi
call   1030 <socket_parse@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1150 <socket_parse_addr+0x30>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%ecx
call   1040 <socket_address_init@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.address = type { i32 }
define i32 @socket_parse_addr(i8* %0, %struct.address* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @socket_parse(i8* %0, i32* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 @socket_address_init(%struct.address* %1, i8* %0, i32 %8, i32 %5)
br label %10
10: ; preds = %2, %7
ret i32 %5
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int gca_cmp2_charptr(const void *aa, const void *bb, void *p) {
  (void)p;
  const char *const a = *(const char *const *)aa;
  const char *const b = *(const char *const *)bb;
  return strcmp(a, b);
}


x86 assembly (clang, -O0):
<gca_cmp2_charptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gca_cmp2_charptr>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @gca_cmp2_charptr(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %7
%13 = load i8*, i8** %5
%14 = bitcast i8* %13 to i8**
%15 = load i8*, i8** %14
store i8* %15, i8** %8
%16 = load i8*, i8** %7
%17 = load i8*, i8** %8
%18 = call i32 @strcmp(i8* %16, i8* %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @gca_cmp2_charptr(i8* nocapture %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = bitcast i8* %0 to i8**
%5 = load i8*, i8** %4
%6 = bitcast i8* %1 to i8**
%7 = load i8*, i8** %6
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void main() {
  char *c = "123";
  printf("%p\n", c);
}


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

x86 assembly (clang, -O2):
<main>:
lea    0xeed(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"123\00"
@.str.1 = [4 x i8] c"%p\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
void RTLinuxSysFsClose(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLinuxSysFsClose() {
ret void
}
/* Variables and functions */
int digit_sum(int);
int get_integer();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int x;
  printf("Digit sum - another exciting program\n");
  printf("   from Furball Enterprises, Inc.\n\n");
  x = get_integer();
  printf("Sum of the digits of %d is %d.\n", x, digit_sum(x));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <get_integer@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <digit_sum@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <get_integer@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <digit_sum@plt>
lea    0xe90(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Digit sum - another exciting program\0A\00"
@.str.1 = [36 x i8] c" from Furball Enterprises, Inc.\0A\0A\00"
@.str.2 = [32 x i8] c"Sum of the digits of %d is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @get_integer()
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @digit_sum(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [32 x i8] c"Sum of the digits of %d is %d.\0A\00"
@str = [37 x i8] c"Digit sum - another exciting program\00"
@str.3 = [35 x i8] c" from Furball Enterprises, Inc.\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 (...) @get_integer()
%4 = tail call i32 @digit_sum(i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}
int codegen_timing_winchip2_jump_cycles() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @codegen_timing_winchip2_jump_cycles() {
ret i32 0
}
int toupper(int c) {
  if (c >= 'a' && c <= 'z')
    c -= 0x20;
  return c;
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1124 <toupper+0x24>
cmpl   $0x7a,-0x4(%rbp)
jg     1124 <toupper+0x24>
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @toupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 32
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %5, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
int isNumberPrime(long numberToCheck) {
  long denominator = 2;
  int retVal = 1;
  while (denominator < numberToCheck) {
    if (0 == (numberToCheck / denominator)) {
      retVal = 0;
      break;
    }
    denominator++;
  }
  return retVal;
}


x86 assembly (clang, -O0):
<isNumberPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x2,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    115a <isNumberPrime+0x5a>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1149 <isNumberPrime+0x49>
movl   $0x0,-0x14(%rbp)
jmp    115a <isNumberPrime+0x5a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <isNumberPrime+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumberPrime>:
mov    $0x1,%ecx
cmp    $0x3,%rdi
jl     1144 <isNumberPrime+0x44>
mov    $0x2,%esi
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1130 <isNumberPrime+0x30>
mov    %rdi,%rax
cqto
idiv   %rsi
test   %rax,%rax
jne    113b <isNumberPrime+0x3b>
jmp    1147 <isNumberPrime+0x47>
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %rax,%rax
je     1147 <isNumberPrime+0x47>
add    $0x1,%rsi
cmp    %rsi,%rdi
jne    1110 <isNumberPrime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isNumberPrime(i64 %0) {
%2 = icmp sgt i64 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i64 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i64 [ %9, %3 ], [ 2, %1 ]
%7 = sdiv i64 %0, %6
%8 = icmp eq i64 %7, 0
%9 = add nuw nsw i64 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %3, %5, %1
%11 = phi i32 [ 1, %1 ], [ 0, %5 ], [ 1, %3 ]
ret i32 %11
}
void foo273() {}


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

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

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

LLVM IR (-O2):
define void @foo273() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug_ol(char *);
int /*<<< orphan*/ ol(char *);
zret() {
  debug_ol("; zret");
  ol("rts");
}


x86 assembly (clang, -O0):
<zret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <debug_ol@plt>
lea    0xecc(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zret>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <debug_ol@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"; zret\00"
@.str.1 = [4 x i8] c"rts\00"
define i32 @zret() {
%1 = alloca i32
%2 = call i32 @debug_ol(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @ol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [7 x i8] c"; zret\00"
@.str.1 = [4 x i8] c"rts\00"
define i32 @zret() {
%1 = tail call i32 @debug_ol(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 undef
}
void genc_ueq_s() {}


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

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

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

LLVM IR (-O2):
define void @genc_ueq_s() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void err(int n) {
  if (n == 1)
    printf("You have a clash! Please repeat this course with a different hour "
           "selection!\n");
  else
    printf("Please enter one of the valid day options(1 through 6). Please "
           "read the codes carefully!\n");
}


x86 assembly (clang, -O0):
<err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1136 <err+0x26>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <err+0x32>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err>:
cmp    $0x1,%edi
lea    0xf3f(%rip),%rax
lea    0xedf(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [78 x i8] c"You have a clash! Please repeat this course with a different hour selection!\0A\00"
@.str.1 = [90 x i8] c"Please enter one of the valid day options(1 through 6). Please read the codes carefully!\0A\00"
define void @err(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@str = [89 x i8] c"Please enter one of the valid day options(1 through 6). Please read the codes carefully!\00"
@str.2 = [77 x i8] c"You have a clash! Please repeat this course with a different hour selection!\00"
define void @err(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([89 x i8], [89 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret void
}
int valid_priv(int c) {
  int rv;
  switch (c) {
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
  case 0x0f:
    rv = 1;
    break;
  default:
    rv = 0;
    break;
  }
  return rv;
}


x86 assembly (clang, -O0):
<valid_priv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x5,%eax
jb     112f <valid_priv+0x2f>
jmp    111e <valid_priv+0x1e>
mov    -0xc(%rbp),%eax
sub    $0xf,%eax
jne    113b <valid_priv+0x3b>
jmp    112f <valid_priv+0x2f>
movl   $0x1,-0x8(%rbp)
jmp    1142 <valid_priv+0x42>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_priv>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0xe,%edi
ja     1117 <valid_priv+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @valid_priv(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %6 [
i32 1, label %5
i32 2, label %5
i32 3, label %5
i32 4, label %5
i32 5, label %5
i32 15, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1
store i32 1, i32* %3
br label %7
6: ; preds = %1
store i32 0, i32* %3
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
@switch.table.valid_priv = [15 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1]
define i32 @valid_priv(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 15
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [15 x i32], [15 x i32]* @switch.table.valid_priv, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
unsigned long long _hi(double src) {
  unsigned long long v;
  *(double *)&v = src;
  return v >> 32;
}


x86 assembly (clang, -O0):
<_hi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x20,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hi>:
movq   %xmm0,%rax
shr    $0x20,%rax
ret

LLVM IR (-O0):
define i64 @_hi(double %0) {
%2 = alloca double
%3 = alloca i64
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast i64* %3 to double*
store double %4, double* %5
%6 = load i64, i64* %3
%7 = lshr i64 %6, 32
ret i64 %7
}

LLVM IR (-O2):
define i64 @_hi(double %0) {
%2 = bitcast double %0 to i64
%3 = lshr i64 %2, 32
ret i64 %3
}
extern unsigned char inb(unsigned short port) {
  unsigned char _v;
  __asm__ __volatile__("in"
                       "b"
                       " %"
                       "w"
                       "1,%"
                       ""
                       "0"
                       : "=a"(_v)
                       : "Nd"(port));
  return _v;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm sideeffect "inb ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() { printf("%zu", sizeof(char)); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%zu\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
int lite_hash_table_find_closest_shift(int n) {
  int i;
  for (int i = 0; n; i++)
    n >>= 1;
  return i;
}


x86 assembly (clang, -O0):
<lite_hash_table_find_closest_shift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112f <lite_hash_table_find_closest_shift+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <lite_hash_table_find_closest_shift+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @lite_hash_table_find_closest_shift(i32 %0) {
ret i32 undef
}
char *cio_file_st_get_meta(char *map) { return map + 24; }


x86 assembly (clang, -O0):
<cio_file_st_get_meta>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x18,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cio_file_st_get_meta>:
lea    0x18(%rdi),%rax
ret

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

LLVM IR (-O2):
define i8* @cio_file_st_get_meta(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 24
ret i8* %2
}
/* Variables and functions */
long sqrt(long);
int is_square(long number) {
  if (sqrt(number) - (long)sqrt(number) == 0) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sqrt@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sqrt@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
cmp    $0x0,%rax
jne    1152 <is_square+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1159 <is_square+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_square>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <sqrt@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <sqrt@plt>
xor    %ecx,%ecx
cmp    %rax,%r14
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @is_square(i64 %0) {
%2 = tail call i64 @sqrt(i64 %0)
%3 = tail call i64 @sqrt(i64 %0)
%4 = icmp eq i64 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
double log_add(double, double);
void log_plus_equals(double *l1, double l2) { *l1 = log_add(*l1, l2); }


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

x86 assembly (clang, -O2):
<log_plus_equals>:
push   %rbx
movaps %xmm0,%xmm1
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
call   1030 <log_add@plt>
movsd  %xmm0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @log_plus_equals(double* nocapture %0, double %1) {
%3 = load double, double* %0
%4 = tail call double @log_add(double %3, double %1)
store double %4, double* %0
ret void
}
int simple_is_digit(char c) {
  int result = 0;
  if (c >= '0' && c <= '9')
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<simple_is_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1132 <simple_is_digit+0x32>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     1132 <simple_is_digit+0x32>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_is_digit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @simple_is_digit(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %3
br label %12
12: ; preds = %11, %7, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @simple_is_digit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
char *f(char *s, unsigned int i) { return &s[i + 3 - 1]; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0x2(%rsi),%eax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @f(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 = add i32 %6, 3
%8 = sub i32 %7, 1
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
ret i8* %10
}

LLVM IR (-O2):
define i8* @f(i8* readnone %0, i32 %1) {
%3 = add i32 %1, 2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
ret i8* %5
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_setschedparam(pthread_attr_t *attr,
                               const struct sched_param *param) {
  return 1;
}


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

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

LLVM IR (-O0):
%struct.sched_param = type { i32 }
define i32 @pthread_attr_setschedparam(i32* %0, %struct.sched_param* %1) {
%3 = alloca i32*
%4 = alloca %struct.sched_param*
store i32* %0, i32** %3
store %struct.sched_param* %1, %struct.sched_param** %4
ret i32 1
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
define i32 @pthread_attr_setschedparam(i32* nocapture readnone %0, %struct.sched_param* nocapture readnone %1) {
ret i32 1
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
long native___NativeString_fetch_4_ffi___impl(char *self, long pos) {
  return (long)*((uint32_t *)(self + pos));
}


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

x86 assembly (clang, -O2):
<native___NativeString_fetch_4_ffi___impl>:
mov    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @native___NativeString_fetch_4_ffi___impl(i8* %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 = load i64, i64* %4
%7 = getelementptr inbounds i8, i8* %5, i64 %6
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @native___NativeString_fetch_4_ffi___impl(i8* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
%4 = bitcast i8* %3 to i64*
%5 = load i64, i64* %4
ret i64 %5
}