xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long window;
};
typedef TYPE_1__ XMapRequestEvent;

/* Variables and functions */
void set_XMapRequestEvent_window(void *_p, unsigned long _v) {
  ((XMapRequestEvent *)_p)->window = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XMapRequestEvent_window(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XMapRequestEvent_window(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ mp_get_memory_functions(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/ *,
                                           void (*)(void *, size_t));
void _nettle_gmp_free(void *p, size_t n) {
  void (*free_func)(void *, size_t);
  assert(n > 0);
  assert(p != 0);
  mp_get_memory_functions(NULL, NULL, &free_func);
  free_func(p, (size_t)n);
}


x86 assembly (clang, -O0):
<_nettle_gmp_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1040 <mp_get_memory_functions@plt>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nettle_gmp_free>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rsp,%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <mp_get_memory_functions@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   *(%rsp)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @_nettle_gmp_free(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca void (i8*, i64)*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = icmp ugt i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = bitcast void (i8*, i64)** %5 to void (i8*, i64)*
%15 = call i32 @mp_get_memory_functions(i32* null, i32* null, void (i8*, i64)* %14)
%16 = load void (i8*, i64)*, void (i8*, i64)** %5
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
ret void
}

LLVM IR (-O2):
define void @_nettle_gmp_free(i8* %0, i64 %1) {
%3 = alloca void (i8*, i64)*
%4 = bitcast void (i8*, i64)** %3 to i8*
%5 = icmp ne i64 %1, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp ne i8* %0, null
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = bitcast void (i8*, i64)** %3 to void (i8*, i64)*
%12 = call i32 @mp_get_memory_functions(i32* null, i32* null, void (i8*, i64)* %11)
%13 = load void (i8*, i64)*, void (i8*, i64)** %3
ret void
}
int NotEoln(char c) { return c != 13 && c != 10; }


x86 assembly (clang, -O0):
<NotEoln>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
je     1129 <NotEoln+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NotEoln>:
cmp    $0xd,%dil
setne  %al
cmp    $0xa,%dil
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @NotEoln(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 13
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @NotEoln(i8 signext %0) {
%2 = icmp ne i8 %0, 13
%3 = icmp ne i8 %0, 10
%4 = and i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct pbc_env {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pbc_delete(struct pbc_env *);
struct pbc_env *pbc_new();
int /*<<< orphan*/ test_decode(struct pbc_env *, char *);
int main(int argc, char *argv[]) {
  struct pbc_env *env = pbc_new();
  test_decode(env, argv[1]);
  pbc_delete(env);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pbc_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <test_decode@plt>
mov    -0x18(%rbp),%rdi
call   1030 <pbc_delete@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
xor    %eax,%eax
call   1050 <pbc_new@plt>
mov    %rax,%rbx
mov    0x8(%r14),%rsi
mov    %rax,%rdi
call   1040 <test_decode@plt>
mov    %rbx,%rdi
call   1030 <pbc_delete@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.pbc_env = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.pbc_env*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call %struct.pbc_env* (...) @pbc_new()
store %struct.pbc_env* %7, %struct.pbc_env** %6
%8 = load %struct.pbc_env*, %struct.pbc_env** %6
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @test_decode(%struct.pbc_env* %8, i8* %11)
%13 = load %struct.pbc_env*, %struct.pbc_env** %6
%14 = call i32 @pbc_delete(%struct.pbc_env* %13)
ret i32 0
}

LLVM IR (-O2):
%struct.pbc_env = type { i32 }
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call %struct.pbc_env* (...) @pbc_new()
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @test_decode(%struct.pbc_env* %3, i8* %5)
%7 = tail call i32 @pbc_delete(%struct.pbc_env* %3)
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int InitPort(char *str) { return atoi(str); }


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

x86 assembly (clang, -O2):
<InitPort>:
jmp    1030 <atoi@plt>

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

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


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

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

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

LLVM IR (-O2):
define void @LTDC_ER_IRQHandler() {
ret void
}
int test_imm_1Auint8_reg(unsigned char val) {
  return ((val) & (-0x1A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Auint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffffe6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_1Auint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -26
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int main(void) {
  print("Hello World!\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 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ WriteCmd(int);
void OLED_Disable(void) {
  WriteCmd(0X8D);
  WriteCmd(0X10);
  WriteCmd(0XAE);
}


x86 assembly (clang, -O0):
<OLED_Disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8d,%edi
call   1030 <WriteCmd@plt>
mov    $0x10,%edi
call   1030 <WriteCmd@plt>
mov    $0xae,%edi
call   1030 <WriteCmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OLED_Disable>:
push   %rax
mov    $0x8d,%edi
call   1030 <WriteCmd@plt>
mov    $0x10,%edi
call   1030 <WriteCmd@plt>
mov    $0xae,%edi
pop    %rax
jmp    1030 <WriteCmd@plt>

LLVM IR (-O0):
define void @OLED_Disable() {
%1 = call i32 @WriteCmd(i32 141)
%2 = call i32 @WriteCmd(i32 16)
%3 = call i32 @WriteCmd(i32 174)
ret void
}

LLVM IR (-O2):
define void @OLED_Disable() {
%1 = tail call i32 @WriteCmd(i32 141)
%2 = tail call i32 @WriteCmd(i32 16)
%3 = tail call i32 @WriteCmd(i32 174)
ret void
}
/* Type definitions */
typedef int fpu_control_t;

/* Variables and functions */
int /*<<< orphan*/ _FPU_GETCW(int);
int /*<<< orphan*/ _FPU_SETCW(int);
int __fesetround(int round) {
  fpu_control_t cw;
  if ((round & ~0x1) != 0)
    return 1;
  _FPU_GETCW(cw);
  cw &= ~0x1;
  cw |= round;
  _FPU_SETCW(cw);
  return 0;
}


x86 assembly (clang, -O0):
<__fesetround>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xfffffffe,%eax
cmp    $0x0,%eax
je     1146 <__fesetround+0x26>
movl   $0x1,-0x4(%rbp)
jmp    116f <__fesetround+0x4f>
mov    -0xc(%rbp),%edi
call   1030 <_FPU_GETCW@plt>
mov    -0xc(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <_FPU_SETCW@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fesetround>:
mov    $0x1,%eax
cmp    $0x1,%edi
ja     113c <__fesetround+0x1c>
push   %rbx
mov    %edi,%ebx
call   1030 <_FPU_GETCW@plt>
mov    %ebx,%edi
call   1040 <_FPU_SETCW@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @__fesetround(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, -2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %19
9: ; preds = %1
%10 = load i32, i32* %4
%11 = call i32 @_FPU_GETCW(i32 %10)
%12 = load i32, i32* %4
%13 = and i32 %12, -2
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = or i32 %15, %14
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = call i32 @_FPU_SETCW(i32 %17)
store i32 0, i32* %2
br label %19
19: ; preds = %9, %8
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @__fesetround(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @_FPU_GETCW(i32 undef)
%5 = tail call i32 @_FPU_SETCW(i32 %0)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ 0, %3 ], [ 1, %1 ]
ret i32 %7
}
int test_imm_BEint64_lowword_mem(long long *val) {
  return ((*val) & (0xBE << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BEint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 190
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memory_free(char *);
int /*<<< orphan*/ print_free_blocks();
void free(void *p) {
  if (p == NULL)
    return;
  memory_free((char *)p);
  print_free_blocks();
}


x86 assembly (clang, -O0):
<free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <free+0x1c>
jmp    114c <free+0x2c>
mov    -0x8(%rbp),%rdi
call   1030 <memory_free@plt>
mov    $0x0,%al
call   1040 <print_free_blocks@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free>:
test   %rdi,%rdi
je     1133 <free+0x13>
push   %rax
call   1030 <memory_free@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <print_free_blocks@plt>
ret

LLVM IR (-O0):
define void @free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %10
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @memory_free(i8* %7)
%9 = call i32 (...) @print_free_blocks()
br label %10
10: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @memory_free(i8* %0)
%5 = tail call i32 (...) @print_free_blocks()
br label %6
6: ; preds = %1, %3
ret void
}
void devcoredump_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @devcoredump_exit() {
ret void
}
/* Type definitions */
struct notifier_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wdt_turnoff();
int wdt_notify_sys(struct notifier_block *this, unsigned long code,
                   void *unused) {
  {
    if (code == 1UL) {
      wdt_turnoff();
    } else if (code == 2UL) {
      wdt_turnoff();
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<wdt_notify_sys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    113b <wdt_notify_sys+0x2b>
mov    $0x0,%al
call   1030 <wdt_turnoff@plt>
jmp    1152 <wdt_notify_sys+0x42>
cmpq   $0x2,-0x10(%rbp)
jne    114d <wdt_notify_sys+0x3d>
mov    $0x0,%al
call   1030 <wdt_turnoff@plt>
jmp    1152 <wdt_notify_sys+0x42>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdt_notify_sys>:
add    $0xffffffffffffffff,%rsi
cmp    $0x1,%rsi
ja     1126 <wdt_notify_sys+0x16>
push   %rax
xor    %eax,%eax
call   1030 <wdt_turnoff@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.notifier_block = type { i32 }
define i32 @wdt_notify_sys(%struct.notifier_block* nocapture readnone %0, i64 %1, i8* nocapture readnone %2) {
%4 = add i64 %1, -1
%5 = icmp ult i64 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @wdt_turnoff()
br label %8
8: ; preds = %3, %6
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ glTranslatef(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/);
void Translatef(GLfloat dx, GLfloat dy, GLfloat dz) {
  glTranslatef(dx, dy, dz);
}


x86 assembly (clang, -O0):
<Translatef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <glTranslatef@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Translatef>:
jmp    1030 <glTranslatef@plt>

LLVM IR (-O0):
define void @Translatef(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
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @glTranslatef(i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @Translatef(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @glTranslatef(i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int do_some_job(int, int, int, int);
int prologue_epilogue_4(int a0, int a1, int a2, int a3) {
  int v0;
  v0 = do_some_job(a0, a1, a2, a3);
  return v0;
}


x86 assembly (clang, -O0):
<prologue_epilogue_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <do_some_job@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prologue_epilogue_4>:
jmp    1030 <do_some_job@plt>

LLVM IR (-O0):
define i32 @prologue_epilogue_4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @do_some_job(i32 %10, i32 %11, i32 %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
define i32 @prologue_epilogue_4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @do_some_job(i32 %0, i32 %1, i32 %2, i32 %3)
ret i32 %5
}
int findSetbit(int x) {
  int i;
  for (i = 0; i < 32; i++) {
    if (x && (1 << i)) {
      return i;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<findSetbit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1153 <findSetbit+0x53>
cmpl   $0x0,-0x8(%rbp)
je     1140 <findSetbit+0x40>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    $0x0,%eax
je     1140 <findSetbit+0x40>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <findSetbit+0x5a>
jmp    1145 <findSetbit+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <findSetbit+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @findSetbit(i32 %0) {
ret i32 0
}
void SPIM_RestoreConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @SPIM_RestoreConfig() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void func(int a) { printf("Passed value %d\n", a); }


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

x86 assembly (clang, -O2):
<func>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c"Passed value %d\0A\00"
define void @func(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
const char *plural(long i) { return (i != 1) ? "s" : ""; }


x86 assembly (clang, -O0):
<plural>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xeee(%rip),%rax
lea    0xee6(%rip),%rcx
cmp    $0x1,%rdx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<plural>:
cmp    $0x1,%rdi
lea    0xef6(%rip),%rcx
lea    0xeee(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"s\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @plural(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ne i64 %3, 1
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [2 x i8] c"s\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @plural(i64 %0) {
%2 = icmp eq i64 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
const char *strna(const char *s) { return s ? s : "n/a"; }


x86 assembly (clang, -O0):
<strna>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1120 <strna+0x20>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <strna+0x30>
lea    0xed9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <strna+0x30>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strna>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmovne %rdi,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"n/a\00"
define i8* @strna(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i8*, i8** %2
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %5
%9 = phi i8* [ %6, %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %7 ]
ret i8* %9
}

LLVM IR (-O2):
@.str = [4 x i8] c"n/a\00"
define i8* @strna(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0
ret i8* %3
}
/* Type definitions */
typedef unsigned char uint32_t;

/* Variables and functions */
uint32_t get4BE(const unsigned char *buf) {
  uint32_t val;
  val = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
  return val;
}


x86 assembly (clang, -O0):
<get4BE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @get4BE(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ glRasterPos2f(int, int);
int /*<<< orphan*/ glutBitmapCharacter(void *, char);
void textString(int x, int y, char *msg, void *font) {
  glRasterPos2f(x, y);
  while (*msg) {
    glutBitmapCharacter(font, *msg);
    msg++;
  }
}


x86 assembly (clang, -O0):
<textString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glRasterPos2f@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116f <textString+0x4f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <glutBitmapCharacter@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1141 <textString+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<textString>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
call   1040 <glRasterPos2f@plt>
mov    (%rbx),%al
test   %al,%al
je     1156 <textString+0x36>
add    $0x1,%rbx
nopl   0x0(%rax)
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <glutBitmapCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <textString+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @textString(i32 %0, i32 %1, i8* nocapture %2, i8* %3) {
%5 = tail call i32 @glRasterPos2f(i32 %0, i32 %1)
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %4, %8
%9 = phi i8 [ %13, %8 ], [ %6, %4 ]
%10 = phi i8* [ %12, %8 ], [ %2, %4 ]
%11 = tail call i32 @glutBitmapCharacter(i8* %3, i8 signext %9)
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %8
15: ; preds = %8, %4
ret void
}
/* Variables and functions */
int close(int);
int can_close(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<can_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @can_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void log_log(char *msg, char *format, va_list args) {
  fprintf(stderr, "[%s] ", msg);
  vfprintf(stderr, format, args);
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<log_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <vfprintf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_log>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2ead(%rip),%r14
mov    (%r14),%edi
lea    0xec3(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <vfprintf@plt>
mov    (%r14),%edi
lea    0xeab(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"[%s] \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @log_log(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @vfprintf(i32 %10, i8* %11, i32 %12)
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"[%s] \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @log_log(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 @vfprintf(i32 %6, i8* %1, i32 %2)
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int getgid();
int getuid();
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  printf("user ID is %d, group ID is %d\n", getuid(), getgid());
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getgid@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"user ID is %d, group ID is %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getuid()
%3 = call i32 (...) @getgid()
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"user ID is %d, group ID is %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i32 (...) @getgid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 0
}
void producer(int c[][5]) {
  int i;
  for (i = 0; i < 5; ++i) {
    c[4][i] = 4;
  }
}


x86 assembly (clang, -O0):
<producer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1137 <producer+0x37>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x4,0x50(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <producer+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<producer>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,0x50(%rdi)
movl   $0x4,0x60(%rdi)
ret

LLVM IR (-O0):
define void @producer([5 x i32]* %0) {
%2 = alloca [5 x i32]*
%3 = alloca i32
store [5 x i32]* %0, [5 x i32]** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load [5 x i32]*, [5 x i32]** %2
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 4
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 %11
store i32 4, i32* %12
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @producer([5 x i32]* nocapture writeonly %0) {
%2 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 4, i64 0
%3 = bitcast i32* %2 to <4 x i32>*
store <4 x i32> <i32 4, i32 4, i32 4, i32 4>, <4 x i32>* %3
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 4, i64 4
store i32 4, i32* %4
ret void
}
int KAPI_GetXVersion_MAJOR() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @KAPI_GetXVersion_MAJOR() {
ret i32 0
}
/* Variables and functions */
void *memcpy(void *, void const *, size_t);
void *mm_block_memcpy(void *dest, const void *src, size_t n) {
  return memcpy(dest, src, n);
}


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

x86 assembly (clang, -O2):
<mm_block_memcpy>:
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define i8* @mm_block_memcpy(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %2, i1 false)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ cpuid(unsigned int, unsigned int *, unsigned int *,
                         unsigned int *, unsigned int *);
unsigned int cpuid_ecx(unsigned int op) {
  unsigned int eax, ebx, ecx, edx;
  cpuid(op, &eax, &ebx, &ecx, &edx);
  return ecx;
}


x86 assembly (clang, -O0):
<cpuid_ecx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_ecx>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1030 <cpuid@plt>
mov    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpuid_ecx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @cpuid(i32 %7, i32* %3, i32* %4, i32* %5, i32* %6)
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @cpuid_ecx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = call i32 @cpuid(i32 %0, i32* %2, i32* %3, i32* %4, i32* %5)
%11 = load i32, i32* %4
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void main(void) { puts("Hello World\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define void @main() {
%1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World\0A\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xlFmtError(char *);
void checkineg(long iarg) {
  if (iarg < 0)
    xlFmtError("square root of a negative number");
}


x86 assembly (clang, -O0):
<checkineg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1133 <checkineg+0x23>
lea    0xed2(%rip),%rdi
call   1030 <xlFmtError@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkineg>:
test   %rdi,%rdi
js     1116 <checkineg+0x6>
ret
lea    0xee3(%rip),%rdi
jmp    1030 <xlFmtError@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"square root of a negative number\00"
define void @checkineg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @xlFmtError(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"square root of a negative number\00"
define void @checkineg(i64 %0) {
%2 = icmp slt i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @xlFmtError(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret void
}
int getLock(int lockNumber) {
  int *lockPos = lockNumber ? (int *)5242888 : (int *)5242892;
  while ((*lockPos) != 0)
    ;
}


x86 assembly (clang, -O0):
<getLock>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x50000c,%eax
mov    $0x500008,%ecx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1131 <getLock+0x31>
jmp    111f <getLock+0x1f>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLock>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
cmpl   $0x0,0x500008(,%rax,4)
je     1122 <getLock+0x22>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1120 <getLock+0x20>
ret

LLVM IR (-O0):
define i32 @getLock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32* inttoptr (i64 5242888 to i32*), i32* inttoptr (i64 5242892 to i32*)
store i32* %8, i32** %4
br label %9
9: ; preds = %13, %1
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %9
14: ; preds = %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @getLock(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32* inttoptr (i64 5242892 to i32*), i32* inttoptr (i64 5242888 to i32*)
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1, %6
br label %6
7: ; preds = %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ handle_URG(int /*<<< orphan*/);
int gen_URG() {
  handle_URG(0);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @gen_URG() {
%1 = call i32 @handle_URG(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_URG() {
%1 = tail call i32 @handle_URG(i32 0)
ret i32 0
}
float my_exper(float base, int exp) {
  int i;
  float tmp = base;
  for (i = 0; i < exp - 1; i++) {
    base *= tmp;
  }
  return base;
}


x86 assembly (clang, -O0):
<my_exper>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    114b <my_exper+0x4b>
movss  -0x10(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111d <my_exper+0x1d>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_exper>:
cmp    $0x2,%edi
jl     115c <my_exper+0x5c>
lea    -0x1(%rdi),%ecx
add    $0xfffffffe,%edi
mov    %ecx,%eax
and    $0x7,%eax
movaps %xmm0,%xmm1
cmp    $0x7,%edi
jb     1145 <my_exper+0x45>
and    $0xfffffff8,%ecx
movaps %xmm0,%xmm1
xchg   %ax,%ax
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
add    $0xfffffff8,%ecx
jne    1120 <my_exper+0x20>
test   %eax,%eax
je     1159 <my_exper+0x59>
nopl   0x0(%rax)
mulss  %xmm0,%xmm1
add    $0xffffffff,%eax
jne    1150 <my_exper+0x50>
movaps %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @my_exper(float %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %34
5: ; preds = %2
%6 = add i32 %1, -2
%7 = and i32 %3, 7
%8 = icmp ult i32 %6, 7
br i1 %8, label %24, label %9
9: ; preds = %5
%10 = and i32 %3, -8
br label %11
11: ; preds = %11, %9
%12 = phi float [ %0, %9 ], [ %21, %11 ]
%13 = phi i32 [ 0, %9 ], [ %22, %11 ]
%14 = fmul float %12, %0
%15 = fmul float %14, %0
%16 = fmul float %15, %0
%17 = fmul float %16, %0
%18 = fmul float %17, %0
%19 = fmul float %18, %0
%20 = fmul float %19, %0
%21 = fmul float %20, %0
%22 = add i32 %13, 8
%23 = icmp eq i32 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %5
%25 = phi float [ undef, %5 ], [ %21, %11 ]
%26 = phi float [ %0, %5 ], [ %21, %11 ]
%27 = icmp eq i32 %7, 0
br i1 %27, label %34, label %28
28: ; preds = %24, %28
%29 = phi float [ %31, %28 ], [ %26, %24 ]
%30 = phi i32 [ %32, %28 ], [ 0, %24 ]
%31 = fmul float %29, %0
%32 = add i32 %30, 1
%33 = icmp eq i32 %32, %7
br i1 %33, label %34, label %28
34: ; preds = %24, %28, %2
%35 = phi float [ %0, %2 ], [ %25, %24 ], [ %31, %28 ]
ret float %35
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned char *);
extern void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata) {
  ((void)(userdata), free(bitmap));
}


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

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

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

LLVM IR (-O2):
define void @stbtt_FreeBitmap(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
void t_setup(void) {}


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

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

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

LLVM IR (-O2):
define void @t_setup() {
ret void
}
/* Variables and functions */
void *malloc(unsigned long);
void *nv_malloc(unsigned long n) {
  void *mem;
  mem = malloc(n);
  return mem;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @nv_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
int x40_setup() {
  char cmd[256];
  sprintf(cmd,
          "iptables -A INPUT -p tcp -m multiport --sport 53,80 --tcp-flags "
          "SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d",
          1);
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<x40_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x1,%edx
call   1040 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x40_setup>:
push   %rbx
sub    $0x100,%rsp
lea    0xed1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [106 x i8] c"iptables -A INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x40_setup() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @system(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [106 x i8] c"iptables -A INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x40_setup() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i32 @system(i8* %2)
ret i32 0
}