xunge/DecIR huggingface dataset:
void pnx833x_gpio_select_output(unsigned int pin) {
  if (pin < 32)
    do {
      ((*((volatile unsigned long *)((0xa0000000ul + 0x17E00000ul) +
                                     0xF008))) |= (1 << (pin)));
    } while (0);
  else
    do {
      ((*((volatile unsigned long *)((0xa0000000ul + 0x17E00000ul) +
                                     0xF064))) |= (1 << (pin & 31)));
    } while (0);
}


x86 assembly (clang, -O0):
<pnx833x_gpio_select_output>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jae    113a <pnx833x_gpio_select_output+0x3a>
jmp    1116 <pnx833x_gpio_select_output+0x16>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    $0xb7e0f008,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0xb7e0f008,%eax
mov    %rcx,(%rax)
jmp    1166 <pnx833x_gpio_select_output+0x66>
jmp    113f <pnx833x_gpio_select_output+0x3f>
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    $0xb7e0f064,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0xb7e0f064,%eax
mov    %rcx,(%rax)
jmp    1166 <pnx833x_gpio_select_output+0x66>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnx833x_gpio_select_output>:
mov    %edi,%ecx
mov    $0xb7e0f008,%eax
lea    0x5c(%rax),%rdx
cmp    $0x20,%edi
cmovb  %rax,%rdx
mov    $0x1,%eax
shl    %cl,%eax
cltq
or     %rax,(%rdx)
ret

LLVM IR (-O0):
define void @pnx833x_gpio_select_output(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 32
br i1 %4, label %5, label %13
5: ; preds = %1
br label %6
6: ; preds = %5
%7 = load i32, i32* %2
%8 = shl i32 1, %7
%9 = sext i32 %8 to i64
%10 = load volatile i64, i64* inttoptr (i64 3084972040 to i64*)
%11 = or i64 %10, %9
store volatile i64 %11, i64* inttoptr (i64 3084972040 to i64*)
br label %12
12: ; preds = %6
br label %22
13: ; preds = %1
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = and i32 %15, 31
%17 = shl i32 1, %16
%18 = sext i32 %17 to i64
%19 = load volatile i64, i64* inttoptr (i64 3084972132 to i64*)
%20 = or i64 %19, %18
store volatile i64 %20, i64* inttoptr (i64 3084972132 to i64*)
br label %21
21: ; preds = %14
br label %22
22: ; preds = %21, %12
ret void
}

LLVM IR (-O2):
define void @pnx833x_gpio_select_output(i32 %0) {
%2 = icmp ult i32 %0, 32
%3 = and i32 %0, 31
%4 = select i1 %2, i64* inttoptr (i64 3084972040 to i64*), i64* inttoptr (i64 3084972132 to i64*)
%5 = shl nuw i32 1, %3
%6 = sext i32 %5 to i64
%7 = load volatile i64, i64* %4
%8 = or i64 %7, %6
store volatile i64 %8, i64* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
FILE *fopen(const char *filename, const char *mode) { return ((FILE *)1); }


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

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

LLVM IR (-O0):
define i32* @fopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32* inttoptr (i64 1 to i32*)
}

LLVM IR (-O2):
define i32* @fopen(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32* inttoptr (i64 1 to i32*)
}
int sys_capget(tcp)
struct tcb *tcp;
{
  return printargs(tcp);
}


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

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

LLVM IR (-O0):
%struct.tcb = type opaque
define i32 @sys_capget(%struct.tcb* %0) {
%2 = alloca %struct.tcb*
store %struct.tcb* %0, %struct.tcb** %2
%3 = load %struct.tcb*, %struct.tcb** %2
%4 = call i32 (%struct.tcb*, ...) bitcast (i32 (...)* @printargs to i32 (%struct.tcb*, ...)*)(%struct.tcb* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.tcb = type opaque
define i32 @sys_capget(%struct.tcb* %0) {
%2 = tail call i32 (%struct.tcb*, ...) bitcast (i32 (...)* @printargs to i32 (%struct.tcb*, ...)*)(%struct.tcb* %0)
ret i32 %2
}
f(int a) {
  void *x = 0;
  (void)x;
  if (a) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1125 <f+0x25>
movl   $0x0,-0x4(%rbp)
jmp    112c <f+0x2c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x1,%edi
sbb    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
char *hash_plugin_summary(void) {
  return ("mediawiki \tmd5(salt.'-'.md5(password)) plugin (Wikimedia)");
}


x86 assembly (clang, -O0):
<hash_plugin_summary>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_plugin_summary>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [58 x i8] c"mediawiki \09md5(salt.'-'.md5(password)) plugin (Wikimedia)\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [58 x i8] c"mediawiki \09md5(salt.'-'.md5(password)) plugin (Wikimedia)\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int logical_iterator(int, int, int *, unsigned short);
bool logical_or(unsigned short array_size, bool *boolean_list) {
  return logical_iterator(false, true, boolean_list, array_size);
}


x86 assembly (clang, -O0):
<logical_or>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    %edi,%edi
mov    $0x1,%esi
movzwl -0x2(%rbp),%ecx
call   1030 <logical_iterator@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logical_or>:
mov    %rsi,%rdx
mov    %edi,%ecx
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <logical_iterator@plt>

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

LLVM IR (-O2):
define i32 @logical_or(i16 zeroext %0, i32* %1) {
%3 = tail call i32 @logical_iterator(i32 0, i32 1, i32* %1, i16 zeroext %0)
ret i32 %3
}
/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ printf(char *);
void fork4() {
  printf("L0\n");
  if (fork() != 0) {
    printf("L1\n");
    if (fork() != 0) {
      printf("L2\n");
    }
  }
  printf("Bye\n");
}


x86 assembly (clang, -O0):
<fork4>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%rax
je     116f <fork4+0x4f>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fork@plt>
cmp    $0x0,%rax
je     116a <fork4+0x4a>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    116f <fork4+0x4f>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork4>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
je     115d <fork4+0x3d>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <fork@plt>
test   %rax,%rax
je     115d <fork4+0x3d>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"L0\0A\00"
@.str.1 = [4 x i8] c"L1\0A\00"
@.str.2 = [4 x i8] c"L2\0A\00"
@.str.3 = [5 x i8] c"Bye\0A\00"
define void @fork4() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i64 (...) @fork()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i64 (...) @fork()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
br label %11
11: ; preds = %10, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [3 x i8] c"L0\00"
@str.4 = [4 x i8] c"Bye\00"
@str.5 = [3 x i8] c"L1\00"
@str.6 = [3 x i8] c"L2\00"
define void @fork4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 (...) @fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i64 (...) @fork()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.6, i64 0, i64 0))
br label %10
10: ; preds = %4, %8, %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *Info_ValueForKey(char *, char *);
char *UI_GetBotInfoByNumber(int);
char *UI_GetBotNameByNumber(int num) {
  char *info = UI_GetBotInfoByNumber(num);
  if (info) {
    return Info_ValueForKey(info, "name");
  }
  return "Kyle";
}


x86 assembly (clang, -O0):
<UI_GetBotNameByNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <UI_GetBotInfoByNumber@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115b <UI_GetBotNameByNumber+0x3b>
mov    -0x18(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <Info_ValueForKey@plt>
mov    %rax,-0x8(%rbp)
jmp    1166 <UI_GetBotNameByNumber+0x46>
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UI_GetBotNameByNumber>:
push   %rax
call   1040 <UI_GetBotInfoByNumber@plt>
test   %rax,%rax
je     113b <UI_GetBotNameByNumber+0x1b>
lea    0xece(%rip),%rsi
mov    %rax,%rdi
pop    %rax
jmp    1030 <Info_ValueForKey@plt>
lea    0xec3(%rip),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"name\00"
@.str.1 = [5 x i8] c"Kyle\00"
define i8* @UI_GetBotNameByNumber(i32 %0) {
%2 = tail call i8* @UI_GetBotInfoByNumber(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @Info_ValueForKey(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %1 ]
ret i8* %7
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int /*<<< orphan*/ __wbeu16(int *, int /*<<< orphan*/);
int i2c_transact(int, int, int *, int, int /*<<< orphan*/);
int i2c_write_beint16(int fd, int chip_addr, int reg, int16_t value) {
  uint8_t data[1 + sizeof(uint16_t)];
  data[0] = reg;
  __wbeu16(&data[1], (uint16_t)value);
  return i2c_transact(fd, chip_addr, data, 1 + sizeof(uint16_t), 0);
}


x86 assembly (clang, -O0):
<i2c_write_beint16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
add    $0x4,%rdi
mov    -0x18(%rbp),%rax
mov    %eax,%esi
call   1030 <__wbeu16@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x30(%rbp),%rdx
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1040 <i2c_transact@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_write_beint16>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edx,(%rsp)
lea    0x4(%rsp),%rdi
mov    %ecx,%esi
call   1030 <__wbeu16@plt>
mov    %rsp,%rdx
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1040 <i2c_transact@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @i2c_write_beint16(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca [5 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%10 = load i32, i32* %7
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
store i32 %10, i32* %11
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 1
%13 = load i64, i64* %8
%14 = trunc i64 %13 to i32
%15 = call i32 @__wbeu16(i32* %12, i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
%19 = call i32 @i2c_transact(i32 %16, i32 %17, i32* %18, i32 5, i32 0)
ret i32 %19
}

LLVM IR (-O2):
define i32 @i2c_write_beint16(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca [5 x i32]
%6 = bitcast [5 x i32]* %5 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32 %2, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%9 = trunc i64 %3 to i32
%10 = call i32 @__wbeu16(i32* %8, i32 %9)
%11 = call i32 @i2c_transact(i32 %0, i32 %1, i32* %7, i32 5, i32 0)
ret i32 %11
}
_Noreturn void thrd_exit(int res) { thd_exit((void *)res); }


x86 assembly (clang, -O0):
<thrd_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
mov    $0x0,%al
call   1030 <thd_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thrd_exit>:
movslq %edi,%rdi
xor    %eax,%eax
jmp    1030 <thd_exit@plt>

LLVM IR (-O0):
define void @thrd_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @thd_exit to i32 (i8*, ...)*)(i8* %5)
ret void
}

LLVM IR (-O2):
define void @thrd_exit(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @thd_exit to i32 (i8*, ...)*)(i8* %3)
ret void
}
/* Variables and functions */
int O_CREAT;
int O_TRUNC;
int wr_test(char const *, int, int, int, int);
int test_wr_short_trunc(const char *file) {
  return wr_test(file, 7, 26, O_CREAT | O_TRUNC, 0777);
}


x86 assembly (clang, -O0):
<test_wr_short_trunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ed1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
or     (%rax),%ecx
mov    $0x7,%esi
mov    $0x1a,%edx
mov    $0x1ff,%r8d
call   1030 <wr_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_wr_short_trunc>:
mov    0x2ee1(%rip),%rax
mov    0x2ed2(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    $0x7,%esi
mov    $0x1a,%edx
mov    $0x1ff,%r8d
jmp    1030 <wr_test@plt>

LLVM IR (-O0):
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @test_wr_short_trunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_CREAT
%5 = load i32, i32* @O_TRUNC
%6 = or i32 %4, %5
%7 = call i32 @wr_test(i8* %3, i32 7, i32 26, i32 %6, i32 511)
ret i32 %7
}

LLVM IR (-O2):
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @test_wr_short_trunc(i8* %0) {
%2 = load i32, i32* @O_CREAT
%3 = load i32, i32* @O_TRUNC
%4 = or i32 %3, %2
%5 = tail call i32 @wr_test(i8* %0, i32 7, i32 26, i32 %4, i32 511)
ret i32 %5
}
/* Variables and functions */
char *Sha3(char *, int);
char *sha3_cgo(char *data, int l) { return Sha3(data, l); }


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

x86 assembly (clang, -O2):
<sha3_cgo>:
jmp    1030 <Sha3@plt>

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

LLVM IR (-O2):
define i8* @sha3_cgo(i8* %0, i32 %1) {
%3 = tail call i8* @Sha3(i8* %0, i32 %1)
ret i8* %3
}
void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above,
                                 int current_signal, int current_noise,
                                 int current_txrate) {}


x86 assembly (clang, -O0):
<bgscan_notify_signal_change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.wpa_supplicant = type opaque
define void @bgscan_notify_signal_change(%struct.wpa_supplicant* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.wpa_supplicant*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.wpa_supplicant* %0, %struct.wpa_supplicant** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret void
}

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define void @bgscan_notify_signal_change(%struct.wpa_supplicant* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret void
}
double integer(double *args) { return (double)(long)*args; }


x86 assembly (clang, -O0):
<integer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%rax
cvtsi2sd %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<integer>:
cvttsd2si (%rdi),%rax
cvtsi2sd %rax,%xmm0
ret

LLVM IR (-O0):
define double @integer(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double, double* %3
%5 = fptosi double %4 to i64
%6 = sitofp i64 %5 to double
ret double %6
}

LLVM IR (-O2):
define double @integer(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i64
%4 = sitofp i64 %3 to double
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
void mongo_log_null(int module, int level, void *context, char *format,
                    va_list arg) {}


x86 assembly (clang, -O0):
<mongo_log_null>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @mongo_log_null(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
ret void
}

LLVM IR (-O2):
define void @mongo_log_null(i32 %0, i32 %1, i8* nocapture %2, i8* nocapture %3, i32 %4) {
ret void
}
/* Variables and functions */
int gcd(int, int);
int rand();
int randExponent(int phi, int n) {
  int e = rand() % n;
  while (1) {
    if (gcd(e, phi) == 1)
      return e;
    e = (e + 1) % n;
    if (e <= 2)
      e = 3;
  }
}


x86 assembly (clang, -O0):
<randExponent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <gcd@plt>
cmp    $0x1,%eax
jne    1159 <randExponent+0x39>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jg     1177 <randExponent+0x57>
movl   $0x3,-0xc(%rbp)
jmp    113c <randExponent+0x1c>

x86 assembly (clang, -O2):
<randExponent>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
cltd
idiv   %r14d
mov    %edx,%ebx
mov    %edx,%edi
mov    %ebp,%esi
call   1030 <gcd@plt>
cmp    $0x1,%eax
je     1170 <randExponent+0x50>
mov    $0x3,%r15d
nopl   (%rax)
add    $0x1,%ebx
mov    %ebx,%eax
cltd
idiv   %r14d
mov    %edx,%ebx
cmp    $0x4,%edx
cmovl  %r15d,%ebx
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <gcd@plt>
cmp    $0x1,%eax
jne    1150 <randExponent+0x30>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @randExponent(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, %1
%5 = tail call i32 @gcd(i32 %4, i32 %0)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %9, %2
%8 = phi i32 [ %4, %2 ], [ %14, %9 ]
ret i32 %8
9: ; preds = %2, %9
%10 = phi i32 [ %14, %9 ], [ %4, %2 ]
%11 = add nsw i32 %10, 1
%12 = srem i32 %11, %1
%13 = icmp sgt i32 %12, 3
%14 = select i1 %13, i32 %12, i32 3
%15 = tail call i32 @gcd(i32 %14, i32 %0)
%16 = icmp eq i32 %15, 1
br i1 %16, label %7, label %9
}
void delay(unsigned dly) {
  while (dly--)
    ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1120 <delay+0x20>
jmp    1107 <delay+0x7>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %4, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @delay(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_dump(int);
int /*<<< orphan*/ clang_analyzer_numTimesReached();
int /*<<< orphan*/ clang_analyzer_printState();
void foo(int x) {
  clang_analyzer_dump(x);
  int y = 1;
  clang_analyzer_printState();
  for (; y < 3; ++y)
    clang_analyzer_numTimesReached();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <clang_analyzer_dump@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1040 <clang_analyzer_printState@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1170 <foo+0x40>
mov    $0x0,%al
call   1030 <clang_analyzer_numTimesReached@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1151 <foo+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
call   1050 <clang_analyzer_dump@plt>
xor    %eax,%eax
call   1040 <clang_analyzer_printState@plt>
xor    %eax,%eax
call   1030 <clang_analyzer_numTimesReached@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <clang_analyzer_numTimesReached@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 @clang_analyzer_dump(i32 %0)
%3 = tail call i32 (...) @clang_analyzer_printState()
%4 = tail call i32 (...) @clang_analyzer_numTimesReached()
%5 = tail call i32 (...) @clang_analyzer_numTimesReached()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GrinderGrindInfls(char *);
int /*<<< orphan*/ GrinderGrindLes(char *);
int /*<<< orphan*/ GrinderGrindObjs(char *);
void GrinderGrind() {
  GrinderGrindObjs("ttkb/obj.txt.unsorted");
  GrinderGrindLes("ttkb/le.txt.unsorted");
  GrinderGrindInfls("ttkb/infl.txt.unsorted");
}


x86 assembly (clang, -O0):
<GrinderGrind>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <GrinderGrindObjs@plt>
lea    0xecf(%rip),%rdi
call   1030 <GrinderGrindLes@plt>
lea    0xed8(%rip),%rdi
call   1040 <GrinderGrindInfls@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GrinderGrind>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <GrinderGrindObjs@plt>
lea    0xed2(%rip),%rdi
call   1030 <GrinderGrindLes@plt>
lea    0xedb(%rip),%rdi
pop    %rax
jmp    1040 <GrinderGrindInfls@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"ttkb/obj.txt.unsorted\00"
@.str.1 = [21 x i8] c"ttkb/le.txt.unsorted\00"
@.str.2 = [23 x i8] c"ttkb/infl.txt.unsorted\00"
define void @GrinderGrind() {
%1 = call i32 @GrinderGrindObjs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @GrinderGrindLes(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @GrinderGrindInfls(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"ttkb/obj.txt.unsorted\00"
@.str.1 = [21 x i8] c"ttkb/le.txt.unsorted\00"
@.str.2 = [23 x i8] c"ttkb/infl.txt.unsorted\00"
define void @GrinderGrind() {
%1 = tail call i32 @GrinderGrindObjs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @GrinderGrindLes(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @GrinderGrindInfls(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void *task(void *arg) {
  char c = *((char *)arg);
  for (size_t i = 0; i < 100; ++i) {
    for (size_t j = 0; j < 80; ++j) {
      putchar(c);
    }
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x64,-0x20(%rbp)
jae    1180 <task+0x70>
movq   $0x0,-0x28(%rbp)
cmpq   $0x50,-0x28(%rbp)
jae    1165 <task+0x55>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1140 <task+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112d <task+0x1d>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<task>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
movsbl (%rdi),%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x50,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
jne    1130 <task+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    $0x64,%r14
jne    1120 <task+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @task(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
store i8 %8, i8* %4
store i64 0, i64* %5
br label %9
9: ; preds = %24, %1
%10 = load i64, i64* %5
%11 = icmp ult i64 %10, 100
br i1 %11, label %12, label %27
12: ; preds = %9
store i64 0, i64* %6
br label %13
13: ; preds = %19, %12
%14 = load i64, i64* %6
%15 = icmp ult i64 %14, 80
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i8, i8* %4
%18 = call i32 @putchar(i8 signext %17)
br label %19
19: ; preds = %16
%20 = load i64, i64* %6
%21 = add i64 %20, 1
store i64 %21, i64* %6
br label %13
22: ; preds = %13
%23 = call i32 @putchar(i8 signext 10)
br label %24
24: ; preds = %22
%25 = load i64, i64* %5
%26 = add i64 %25, 1
store i64 %26, i64* %5
br label %9
27: ; preds = %9
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
define noalias i8* @task(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %1, %6
%4 = phi i64 [ 0, %1 ], [ %8, %6 ]
br label %10
5: ; preds = %6
ret i8* undef
6: ; preds = %10
%7 = tail call i32 @putchar(i8 signext 10)
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i64 %8, 100
br i1 %9, label %5, label %3
10: ; preds = %3, %10
%11 = phi i64 [ 0, %3 ], [ %13, %10 ]
%12 = tail call i32 @putchar(i8 signext %2)
%13 = add nuw nsw i64 %11, 1
%14 = icmp eq i64 %13, 80
br i1 %14, label %6, label %10
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
void pthread_function() { printf("pthread function pid = \t%d\n", getpid()); }


x86 assembly (clang, -O0):
<pthread_function>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_function>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"pthread function pid = \09%d\0A\00"
define void @pthread_function() {
%1 = call i32 (...) @getpid()
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"pthread function pid = \09%d\0A\00"
define void @pthread_function() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int gcd(int a, int b) {
  int c = a % b;
  while (c) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1139 <gcd+0x39>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1114 <gcd+0x14>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1120 <gcd+0x20>
nopl   0x0(%rax)
mov    %edx,%ecx
mov    %esi,%eax
cltd
idiv   %ecx
mov    %ecx,%esi
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ %3, %2 ]
%7 = phi i32 [ %6, %5 ], [ %1, %2 ]
%8 = srem i32 %7, %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %2
%11 = phi i32 [ %1, %2 ], [ %6, %5 ]
ret i32 %11
}
int main(void) {
  int a = *((char *)0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
movsbl (%rax),%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i8, i8* null
%4 = sext i8 %3 to i32
store i32 %4, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
uint8_t http_tolower(uint8_t c) {
  if (c >= 'A' && c <= 'Z')
    c |= 32;
  return c;
}


x86 assembly (clang, -O0):
<http_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     112e <http_tolower+0x2e>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     112e <http_tolower+0x2e>
movsbl -0x1(%rbp),%eax
or     $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_tolower>:
lea    -0x41(%rdi),%eax
mov    %edi,%ecx
or     $0x20,%cl
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @http_tolower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = or i32 %12, 32
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %10, %6, %1
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @http_tolower(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = or i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_reply_method_error(void *call, const void *e) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_reply_method_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecb(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_reply_method_error>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_reply_method_error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_reply_method_error(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
char *ecvt(val, ndig, pdecpt, psign)
double val;
int ndig, *pdecpt, *psign;
{ return _cvt(0, val, ndig, pdecpt, psign); }


x86 assembly (clang, -O0):
<ecvt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %edi,%edi
mov    $0x1,%al
call   1030 <_cvt@plt>
cltq
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecvt>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
xor    %edi,%edi
mov    $0x1,%al
call   1030 <_cvt@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @ecvt(double %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca double
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store double %0, double* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load double, double* %5
%10 = load i32, i32* %6
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = call i32 (i32, double, i32, i32*, i32*, ...) bitcast (i32 (...)* @_cvt to i32 (i32, double, i32, i32*, i32*, ...)*)(i32 0, double %9, i32 %10, i32* %11, i32* %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
ret i8* %15
}

LLVM IR (-O2):
define i8* @ecvt(double %0, i32 %1, i32* %2, i32* %3) {
%5 = tail call i32 (i32, double, i32, i32*, i32*, ...) bitcast (i32 (...)* @_cvt to i32 (i32, double, i32, i32*, i32*, ...)*)(i32 0, double %0, i32 %1, i32* %2, i32* %3)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *, int *);
void read_dimensions(int *lines, int *columns) {
  scanf("%d %d\n", lines, columns);
}


x86 assembly (clang, -O0):
<read_dimensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_dimensions>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <scanf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define void @read_dimensions(i32* %0, i32* %1) {
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %0, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ReleaseClean();
int SIGINT;
int /*<<< orphan*/ exit(int);
void sig_handler(int sig) {
  if (sig == SIGINT) {
    ReleaseClean();
    exit(1);
  }
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    114e <sig_handler+0x2e>
mov    $0x0,%al
call   1030 <ReleaseClean@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
je     112e <sig_handler+0xe>
pop    %rax
ret
xor    %eax,%eax
call   1030 <ReleaseClean@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 (...) @ReleaseClean()
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 (...) @ReleaseClean()
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}
unsigned long SysCtlResetCauseGet(void) {
  return ((*((volatile unsigned long *)(0x400FE05C))));
}


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

x86 assembly (clang, -O2):
<SysCtlResetCauseGet>:
mov    0x400fe05c,%rax
40
ret

LLVM IR (-O0):
define i64 @SysCtlResetCauseGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074782300 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @SysCtlResetCauseGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074782300 to i64*)
ret i64 %1
}
int match(s1, s2, n)
char *s1, *s2;
int n;
{
  while (n--) {
    if (*s1++ != *s2++)
      return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<match>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1160 <match+0x60>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     115b <match+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1167 <match+0x67>
jmp    110f <match+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match>:
mov    %edx,%r8d
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %ecx,%r8d
je     1128 <match+0x28>
movzbl (%rdi,%rcx,1),%edx
lea    0x1(%rcx),%rax
cmp    (%rsi,%rcx,1),%dl
mov    %rax,%rcx
je     1110 <match+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @match(i8* nocapture %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %0, %3 ], [ %11, %9 ]
%6 = phi i8* [ %1, %3 ], [ %13, %9 ]
%7 = phi i32 [ %2, %3 ], [ %10, %9 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %6
%15 = icmp eq i8 %12, %14
br i1 %15, label %4, label %16
16: ; preds = %4, %9
%17 = phi i32 [ 0, %9 ], [ 1, %4 ]
ret i32 %17
}
int func1(int a) {
  double f = a;
  return f;
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @func1(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
store double %5, double* %3
%6 = load double, double* %3
%7 = fptosi double %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @func1(i32 returned %0) {
ret i32 %0
}
int az_count_chr(const unsigned char source[], int i, const int length,
                 const unsigned char chr) {
  int c = 0;
  while (i < length && source[i] == chr) {
    c++;
    i++;
  }
  return c;
}


x86 assembly (clang, -O0):
<az_count_chr>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x19(%rbp)
jge    1143 <az_count_chr+0x43>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1153 <az_count_chr+0x53>
jmp    116a <az_count_chr+0x6a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111a <az_count_chr+0x1a>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<az_count_chr>:
xor    %eax,%eax
sub    %esi,%edx
jle    111f <az_count_chr+0x1f>
movslq %esi,%rax
add    %rax,%rdi
xor    %eax,%eax
xchg   %ax,%ax
cmp    %cl,(%rdi,%rax,1)
jne    111f <az_count_chr+0x1f>
add    $0x1,%rax
cmp    %eax,%edx
jne    1110 <az_count_chr+0x10>
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @az_count_chr(i8* nocapture %0, i32 %1, i32 %2, i8 zeroext %3) {
%5 = icmp sgt i32 %2, %1
br i1 %5, label %6, label %19
6: ; preds = %4
%7 = sext i32 %1 to i64
%8 = sub i32 %2, %1
br label %9
9: ; preds = %6, %15
%10 = phi i64 [ %7, %6 ], [ %17, %15 ]
%11 = phi i32 [ 0, %6 ], [ %16, %15 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %10
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, %3
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = add nuw i32 %11, 1
%17 = add nsw i64 %10, 1
%18 = icmp eq i32 %16, %8
br i1 %18, label %19, label %9
19: ; preds = %9, %15, %4
%20 = phi i32 [ 0, %4 ], [ %8, %15 ], [ %11, %9 ]
ret i32 %20
}
int condition_squareBracketOpen(char c) { return c == '['; }


x86 assembly (clang, -O0):
<condition_squareBracketOpen>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<condition_squareBracketOpen>:
xor    %eax,%eax
cmp    $0x5b,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @condition_squareBracketOpen(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 91
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @condition_squareBracketOpen(i8 signext %0) {
%2 = icmp eq i8 %0, 91
%3 = zext i1 %2 to i32
ret i32 %3
}