xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
long I2STxDataPutNonBlocking(unsigned long ulBase, unsigned long ulData) {
  DEBUG_ASSERT(ulBase == 0x40054000);
  if ((*((volatile unsigned long *)(ulBase + 0x00000018))) < 16) {
    (*((volatile unsigned long *)(ulBase + 0x00000000))) = ulData;
    return (1);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<I2STxDataPutNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x40054000,-0x10(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
cmp    $0x10,%rax
jae    115f <I2STxDataPutNonBlocking+0x4f>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x1,-0x8(%rbp)
jmp    1167 <I2STxDataPutNonBlocking+0x57>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2STxDataPutNonBlocking>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40054000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    0x18(%rbx),%rax
cmp    $0xf,%rax
ja     1140 <I2STxDataPutNonBlocking+0x30>
mov    %r14,(%rbx)
mov    $0x1,%eax
jmp    1142 <I2STxDataPutNonBlocking+0x32>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @I2STxDataPutNonBlocking(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = icmp eq i64 %6, 1074085888
%8 = zext i1 %7 to i32
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i64, i64* %4
%11 = add i64 %10, 24
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = icmp ult i64 %13, 16
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i64, i64* %5
%17 = load i64, i64* %4
%18 = add i64 %17, 0
%19 = inttoptr i64 %18 to i64*
store volatile i64 %16, i64* %19
store i64 1, i64* %3
br label %21
20: ; preds = %2
store i64 0, i64* %3
br label %21
21: ; preds = %20, %15
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
define i64 @I2STxDataPutNonBlocking(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074085888
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = add i64 %0, 24
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = icmp ult i64 %8, 16
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = inttoptr i64 %0 to i64*
store volatile i64 %1, i64* %11
br label %12
12: ; preds = %2, %10
%13 = phi i64 [ 1, %10 ], [ 0, %2 ]
ret i64 %13
}
/* Type definitions */
struct tag_osn_task {
  int dummy;
};

/* Variables and functions */
struct tag_osn_task *get_task_by_msgq(void *);
int is_exist_msgq(void *msgq) {
  struct tag_osn_task *task = get_task_by_msgq(msgq);
  return task ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_exist_msgq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_task_by_msgq@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_exist_msgq>:
push   %rax
call   1030 <get_task_by_msgq@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tag_osn_task = type { i32 }
define i32 @is_exist_msgq(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tag_osn_task*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call %struct.tag_osn_task* @get_task_by_msgq(i8* %4)
store %struct.tag_osn_task* %5, %struct.tag_osn_task** %3
%6 = load %struct.tag_osn_task*, %struct.tag_osn_task** %3
%7 = icmp ne %struct.tag_osn_task* %6, null
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
ret i32 %9
}

LLVM IR (-O2):
%struct.tag_osn_task = type { i32 }
define i32 @is_exist_msgq(i8* %0) {
%2 = tail call %struct.tag_osn_task* @get_task_by_msgq(i8* %0)
%3 = icmp ne %struct.tag_osn_task* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int64_t Function2Int64(int64_t a, int64_t b) { return a + b; }


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

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

LLVM IR (-O0):
define i64 @Function2Int64(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @Function2Int64(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int countTwinPrimes(int);
int /*<<< orphan*/ printf(char *, int, int);
void test(int limit) {
  int count = countTwinPrimes(limit);
  printf("Number of twin prime pairs less than %d is %d\n", limit, count);
}


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

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    %edi,%ebx
call   1040 <countTwinPrimes@plt>
lea    0xed1(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"Number of twin prime pairs less than %d is %d\0A\00"
define void @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @countTwinPrimes(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"Number of twin prime pairs less than %d is %d\0A\00"
define void @test(i32 %0) {
%2 = tail call i32 @countTwinPrimes(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2)
ret void
}
int LISTEN(int sockfd, int backlog) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @LISTEN(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int Cyc_Tcutil_is_any_float_type(void *);
int Cyc_Tcutil_is_any_int_type(void *);
int Cyc_Tcutil_is_strict_arithmetic_type(void *t) {
  int _T0;
  int _T1;
  _T1 = Cyc_Tcutil_is_any_int_type(t);
  if (!_T1)
    goto _TL24;
  _T0 = 1;
  goto _TL25;
_TL24:
  _T0 = Cyc_Tcutil_is_any_float_type(t);
_TL25:
  return _T0;
}


x86 assembly (clang, -O0):
<Cyc_Tcutil_is_strict_arithmetic_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Cyc_Tcutil_is_any_int_type@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1147 <Cyc_Tcutil_is_strict_arithmetic_type+0x27>
jmp    1153 <Cyc_Tcutil_is_strict_arithmetic_type+0x33>
movl   $0x1,-0xc(%rbp)
jmp    115f <Cyc_Tcutil_is_strict_arithmetic_type+0x3f>
mov    -0x8(%rbp),%rdi
call   1030 <Cyc_Tcutil_is_any_float_type@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Tcutil_is_strict_arithmetic_type>:
push   %rbx
mov    %rdi,%rbx
call   1040 <Cyc_Tcutil_is_any_int_type@plt>
test   %eax,%eax
je     1134 <Cyc_Tcutil_is_strict_arithmetic_type+0x14>
mov    $0x1,%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <Cyc_Tcutil_is_any_float_type@plt>

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

LLVM IR (-O2):
define i32 @Cyc_Tcutil_is_strict_arithmetic_type(i8* %0) {
%2 = tail call i32 @Cyc_Tcutil_is_any_int_type(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @Cyc_Tcutil_is_any_float_type(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 1, %1 ]
ret i32 %7
}
void gdk_fill_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gdk_fill_get_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cli_restore_terminal();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void catch_signals(int sig) {
  sig = sig;
  cli_restore_terminal();
  exit(0);
}


x86 assembly (clang, -O0):
<catch_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <cli_restore_terminal@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<catch_signals>:
push   %rax
xor    %eax,%eax
call   1030 <cli_restore_terminal@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @catch_signals(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store i32 %3, i32* %2
%4 = call i32 (...) @cli_restore_terminal()
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @catch_signals(i32 %0) {
%2 = tail call i32 (...) @cli_restore_terminal()
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct termios {
  int c_cflag;
};
typedef int speed_t;

/* Variables and functions */
int CBAUD;
speed_t cfgetospeed(const struct termios *p) { return p->c_cflag & CBAUD; }


x86 assembly (clang, -O0):
<cfgetospeed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2ec3(%rip),%rcx
and    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfgetospeed>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
and    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@CBAUD = global i32 0
define i32 @cfgetospeed(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load %struct.termios*, %struct.termios** %2
%4 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @CBAUD
%7 = and i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@CBAUD = global i32 0
define i32 @cfgetospeed(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @CBAUD
%5 = and i32 %4, %3
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ uint_least8_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_LESS_uint_least8_t(uint_least8_t const k1,
                                          uint_least8_t const k2) {
  return k1 < k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_MAP_KEY_LESS_uint_least8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_LESS_uint_least8_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

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

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_LESS_uint_least8_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DAEMON;
int /*<<< orphan*/ _logsys_wthread_create();
int /*<<< orphan*/ logsys_config_facility_set(char *, int /*<<< orphan*/);
int /*<<< orphan*/ logsys_config_file_set(char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ logsys_config_mode_set(int);
__attribute__((constructor)) void logsys_system_init(void) {
  char *error_string;
  logsys_config_mode_set((1 << 1) | (1 << 2) | (1 << 8));
  logsys_config_file_set(&error_string, (NULL));
  logsys_config_facility_set("logsystestNOsubsystems", (LOG_DAEMON));
  if ((((1 << 1) | (1 << 2) | (1 << 8)) & (1 << 9)) == 0) {
    _logsys_wthread_create();
  }
}


x86 assembly (clang, -O0):
<logsys_system_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x106,%edi
call   1050 <logsys_config_mode_set@plt>
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <logsys_config_file_set@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
lea    0xe91(%rip),%rdi
call   1060 <logsys_config_facility_set@plt>
mov    $0x0,%al
call   1040 <_logsys_wthread_create@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logsys_system_init>:
push   %rax
mov    $0x106,%edi
call   1050 <logsys_config_mode_set@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <logsys_config_file_set@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
lea    0xe9b(%rip),%rdi
call   1060 <logsys_config_facility_set@plt>
xor    %eax,%eax
call   1040 <_logsys_wthread_create@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"logsystestNOsubsystems\00"
@LOG_DAEMON = global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @logsys_system_init, i8* null }]
define void @logsys_system_init() {
%1 = alloca i8*
%2 = call i32 @logsys_config_mode_set(i32 262)
%3 = call i32 @logsys_config_file_set(i8** %1, i32* null)
%4 = load i32, i32* @LOG_DAEMON
%5 = call i32 @logsys_config_facility_set(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @_logsys_wthread_create()
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"logsystestNOsubsystems\00"
@LOG_DAEMON = global i32 0
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @logsys_system_init, i8* null }]
define void @logsys_system_init() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = tail call i32 @logsys_config_mode_set(i32 262)
%4 = call i32 @logsys_config_file_set(i8** %1, i32* null)
%5 = load i32, i32* @LOG_DAEMON
%6 = call i32 @logsys_config_facility_set(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @_logsys_wthread_create()
ret void
}
/* Type definitions */
struct qcc_list {
  int dummy;
};
struct qcc_interval_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ qcc_list_pop_front(struct qcc_list *);
void qcc_interval_data_pop_front(struct qcc_interval_data *list) {
  qcc_list_pop_front((struct qcc_list *)list);
}


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

x86 assembly (clang, -O2):
<qcc_interval_data_pop_front>:
jmp    1030 <qcc_list_pop_front@plt>

LLVM IR (-O0):
%struct.qcc_interval_data = type { i32 }
%struct.qcc_list = type { i32 }
define void @qcc_interval_data_pop_front(%struct.qcc_interval_data* %0) {
%2 = alloca %struct.qcc_interval_data*
store %struct.qcc_interval_data* %0, %struct.qcc_interval_data** %2
%3 = load %struct.qcc_interval_data*, %struct.qcc_interval_data** %2
%4 = bitcast %struct.qcc_interval_data* %3 to %struct.qcc_list*
%5 = call i32 @qcc_list_pop_front(%struct.qcc_list* %4)
ret void
}

LLVM IR (-O2):
%struct.qcc_interval_data = type { i32 }
%struct.qcc_list = type { i32 }
define void @qcc_interval_data_pop_front(%struct.qcc_interval_data* %0) {
%2 = bitcast %struct.qcc_interval_data* %0 to %struct.qcc_list*
%3 = tail call i32 @qcc_list_pop_front(%struct.qcc_list* %2)
ret void
}
int main(int argc, char *argv[]) {
  int i = 5;
  printf("ha: %c %d = ", "i", i);
  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)
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%edx
lea    0xec9(%rip),%rdi
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"ha: %c %d = \00"
@.str.1 = [2 x i8] c"i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int compStr(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ system(char *);
void main() {
  int result = compStr("ball", "lamp");
  printf("%d\n", result);
  assert(result == 3);
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1060 <compStr@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe89(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1060 <compStr@plt>
mov    %eax,%ebx
lea    0xead(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
cmp    $0x3,%ebx
sete   %dil
call   1050 <assert@plt>
lea    0xe95(%rip),%rdi
pop    %rbx
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"ball\00"
@.str.1 = [5 x i8] c"lamp\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @compStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 3
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"ball\00"
@.str.1 = [5 x i8] c"lamp\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define void @main() {
%1 = tail call i32 @compStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %1, 3
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret void
}
int main() {
  unsigned x;
  const unsigned N = 1 << 5;
  unsigned A[N];
  for (unsigned i = 0; i < N; ++i) {
    A[i] = i;
    x = A[i];
  }
  return (x + 1) % N;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x20,-0xc(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jae    1156 <main+0x56>
mov    -0x1c(%rbp),%ecx
mov    -0x1c(%rbp),%eax
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
mov    -0xa0(%rbp,%rax,4),%eax
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1124 <main+0x24>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
and    $0x1f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void printDebug(const char *msg, ...) { return; }


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

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

LLVM IR (-O0):
define void @printDebug(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @printDebug(i8* nocapture %0, ...) {
ret void
}
char *old_getGT(char *GT, char *ptr) {
  char *tmp;
  tmp = ptr;
  int c = 0;
  while (*tmp) {
    if (':' == *tmp) {
      GT[c] = '\0';
      break;
    } else {
      GT[c] = *tmp;
    }
    c++;
    tmp++;
  }
}


x86 assembly (clang, -O0):
<old_getGT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1178 <old_getGT+0x78>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x3a,%eax
cmp    %ecx,%eax
jne    114d <old_getGT+0x4d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1178 <old_getGT+0x78>
mov    -0x20(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111b <old_getGT+0x1b>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<old_getGT>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
test   %cl,%cl
je     112c <old_getGT+0x2c>
cmp    $0x3a,%cl
je     1126 <old_getGT+0x26>
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
jmp    1110 <old_getGT+0x10>
mov    %eax,%eax
movb   $0x0,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define noalias i8* @old_getGT(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %10, %2
%4 = phi i64 [ %12, %10 ], [ 0, %2 ]
%5 = phi i8* [ %13, %10 ], [ %1, %2 ]
%6 = load i8, i8* %5
switch i8 %6, label %10 [
i8 0, label %14
i8 58, label %7
]
7: ; preds = %3
%8 = and i64 %4, 4294967295
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 0, i8* %9
br label %14
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 %6, i8* %11
%12 = add nuw i64 %4, 1
%13 = getelementptr inbounds i8, i8* %5, i64 1
br label %3
14: ; preds = %3, %7
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char);
int main(void) {
  char *s = "haha";
  printf("%c %c\n", *s, *s - 32);
  printf("%c %c\n", *(s + 1), *(s + 1) - 32);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x20,%eax
lea    0xec4(%rip),%rdi
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x20,%eax
lea    0xea0(%rip),%rdi
movsbl %cl,%esi
movsbl %al,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x68,%esi
mov    $0x48,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
mov    $0x41,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"haha\00"
@.str.1 = [7 x i8] c"%c %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %7, 32
%9 = trunc i32 %8 to i8
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext %4, i8 signext %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 32
%19 = trunc i32 %18 to i8
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext %13, i8 signext %19)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%c %c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext 104, i8 signext 72)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext 97, i8 signext 65)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ shutdown_gpio();
void shutdown_hardware(void) { shutdown_gpio(); }


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

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

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

LLVM IR (-O2):
define void @shutdown_hardware() {
%1 = tail call i32 (...) @shutdown_gpio()
ret void
}
int array_non_zero_int(void *v, int i_count) {
  int i;
  int *x = v;
  i_count >>= 2;
  for (i = 0; i < i_count; i++)
    if (x[i])
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<array_non_zero_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1160 <array_non_zero_int+0x60>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     114d <array_non_zero_int+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1167 <array_non_zero_int+0x67>
jmp    1152 <array_non_zero_int+0x52>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1123 <array_non_zero_int+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_non_zero_int>:
xor    %eax,%eax
cmp    $0x4,%esi
jl     1127 <array_non_zero_int+0x27>
shr    $0x2,%esi
xor    %eax,%eax
nopl   0x0(%rax)
cmpl   $0x0,(%rdi,%rax,4)
jne    1122 <array_non_zero_int+0x22>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <array_non_zero_int+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @array_non_zero_int(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = icmp sgt i32 %1, 3
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = lshr i32 %1, 2
%7 = zext i32 %6 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %15, %7
br i1 %9, label %16, label %10
10: ; preds = %5, %8
%11 = phi i64 [ 0, %5 ], [ %15, %8 ]
%12 = getelementptr inbounds i32, i32* %3, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
%15 = add nuw nsw i64 %11, 1
br i1 %14, label %8, label %16
16: ; preds = %10, %8, %2
%17 = phi i32 [ 0, %2 ], [ 0, %8 ], [ 1, %10 ]
ret i32 %17
}
void devfs_remove(char *fmt, ...) { return; }


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

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

LLVM IR (-O0):
define void @devfs_remove(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @devfs_remove(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
scalar_t__ strlen(char const *);
int string_equal(const char *c1, const char *c2) {
  return (strlen(c1) == strlen(c2)) && (strcmp(c1, c2) == 0);
}


x86 assembly (clang, -O0):
<string_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x11(%rbp)
jne    1172 <string_equal+0x52>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_equal>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
jne    115b <string_equal+0x3b>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @string_equal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = icmp eq i64 %6, %8
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br label %15
15: ; preds = %10, %2
%16 = phi i1 [ false, %2 ], [ %14, %10 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @string_equal(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i64 @strcmp(i8* %0, i8* %1)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int strcmp(char const *, char const *);
int cmpfnc(const void *a, const void *b) {
  const char *pa = *(const char **)a;
  const char *pb = *(const char **)b;
  return strcmp(pa, pb);
}


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

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

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

LLVM IR (-O2):
define i32 @cmpfnc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
char *end_of_name_sp(char *where) {
  char *now = where;
  while ((*now) && ((*now != ' ')))
    now++;
  return now;
}


x86 assembly (clang, -O0):
<end_of_name_sp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1135 <end_of_name_sp+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1145 <end_of_name_sp+0x45>
jmp    1156 <end_of_name_sp+0x56>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <end_of_name_sp+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_of_name_sp>:
mov    %rdi,%rax
testb  $0xdf,(%rax)
je     1119 <end_of_name_sp+0x19>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
testb  $0xdf,(%rax)
jne    1110 <end_of_name_sp+0x10>
ret

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

LLVM IR (-O2):
define i8* @end_of_name_sp(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 32, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
ret i8* %3
}
int pdjpg_abslog2up(int v) {
  int v1, i;
  v1 = (v << 1) ^ (v >> 31);
  i = 0;
  while (v1 > 1) {
    i++;
    v1 = (v1 + 1) >> 1;
  }
  return (i);
}


x86 assembly (clang, -O0):
<pdjpg_abslog2up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
sar    $0x1f,%ecx
xor    %ecx,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1143 <pdjpg_abslog2up+0x43>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <pdjpg_abslog2up+0x1f>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdjpg_abslog2up>:
lea    (%rdi,%rdi,1),%eax
sar    $0x1f,%edi
xor    %eax,%edi
xor    %eax,%eax
cmp    $0x2,%edi
jl     112f <pdjpg_abslog2up+0x2f>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
lea    0x1(%rdi),%ecx
shr    %ecx
cmp    $0x2,%edi
mov    %ecx,%edi
ja     1120 <pdjpg_abslog2up+0x20>
ret

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

LLVM IR (-O2):
define i32 @pdjpg_abslog2up(i32 %0) {
%2 = shl i32 %0, 1
%3 = ashr i32 %0, 31
%4 = xor i32 %2, %3
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %13
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ 0, %1 ]
%8 = phi i32 [ %11, %6 ], [ %4, %1 ]
%9 = add nuw nsw i32 %7, 1
%10 = add nuw nsw i32 %8, 1
%11 = lshr i32 %10, 1
%12 = icmp ugt i32 %8, 2
br i1 %12, label %6, label %13
13: ; preds = %6, %1
%14 = phi i32 [ 0, %1 ], [ %9, %6 ]
ret i32 %14
}
/* Type definitions */
struct cpu {
  int dummy;
};

/* Variables and functions */
unsigned char cpu_get_r8(struct cpu *, int);
unsigned char cpu_get_l(struct cpu *cpu) { return cpu_get_r8(cpu, (6)); }


x86 assembly (clang, -O0):
<cpu_get_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1030 <cpu_get_r8@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_get_l>:
mov    $0x6,%esi
jmp    1030 <cpu_get_r8@plt>

LLVM IR (-O0):
%struct.cpu = type { i32 }
define zeroext i8 @cpu_get_l(%struct.cpu* %0) {
%2 = alloca %struct.cpu*
store %struct.cpu* %0, %struct.cpu** %2
%3 = load %struct.cpu*, %struct.cpu** %2
%4 = call zeroext i8 @cpu_get_r8(%struct.cpu* %3, i32 6)
ret i8 %4
}

LLVM IR (-O2):
%struct.cpu = type { i32 }
define zeroext i8 @cpu_get_l(%struct.cpu* %0) {
%2 = tail call zeroext i8 @cpu_get_r8(%struct.cpu* %0, i32 6)
ret i8 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ hmac_md5(int /*<<< orphan*/, unsigned char *,
                            unsigned char *);
uint32_t hf_md5_generic(void *state, char *key, uint32_t len) {
  uint32_t hashvalue;
  uint32_t digest[16];
  (void)state;
  hmac_md5(len, (unsigned char *)key, (unsigned char *)digest);
  hashvalue = digest[0];
  return hashvalue;
}


x86 assembly (clang, -O0):
<hf_md5_generic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1030 <hmac_md5@plt>
mov    -0x60(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hf_md5_generic>:
sub    $0x48,%rsp
mov    %edx,%edi
mov    %rsp,%rdx
call   1030 <hmac_md5@plt>
mov    (%rsp),%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
define i32 @hf_md5_generic(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [16 x i32]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = load i32, i32* %6
%11 = load i8*, i8** %5
%12 = getelementptr inbounds [16 x i32], [16 x i32]* %8, i64 0, i64 0
%13 = bitcast i32* %12 to i8*
%14 = call i32 @hmac_md5(i32 %10, i8* %11, i8* %13)
%15 = getelementptr inbounds [16 x i32], [16 x i32]* %8, i64 0, i64 0
%16 = load i32, i32* %15
store i32 %16, i32* %7
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @hf_md5_generic(i8* nocapture readnone %0, i8* %1, i32 %2) {
%4 = alloca [16 x i32]
%5 = bitcast [16 x i32]* %4 to i8*
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%7 = call i32 @hmac_md5(i32 %2, i8* %1, i8* %5)
%8 = load i32, i32* %6
ret i32 %8
}
/* Variables and functions */
int f(int /*<<< orphan*/);
int main() {
  int a, b, c;
  if (a) {
    b = f(0);
    c = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113a <main+0x2a>
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void gtk_box_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_box_get_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("\a");
  return (-1);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 7)
ret i32 -1
}
/* Variables and functions */
int rand();
char getRandomCharacter() { return rand() & 0x7F; }


x86 assembly (clang, -O0):
<getRandomCharacter>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0x7f,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomCharacter>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x7f,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @getRandomCharacter() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 127
%3 = trunc i32 %2 to i8
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @getRandomCharacter() {
%1 = tail call i32 (...) @rand()
%2 = trunc i32 %1 to i8
%3 = and i8 %2, 127
ret i8 %3
}
float im_mul_f(float re1, float im1, float re2, float im2) {
  return re1 * im2 + im1 * re2;
}


x86 assembly (clang, -O0):
<im_mul_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<im_mul_f>:
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @im_mul_f(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %8
%11 = load float, float* %6
%12 = load float, float* %7
%13 = fmul float %11, %12
%14 = call float @llvm.fmuladd.f32(float %9, float %10, float %13)
ret float %14
}

LLVM IR (-O2):
define float @im_mul_f(float %0, float %1, float %2, float %3) {
%5 = fmul float %1, %2
%6 = tail call float @llvm.fmuladd.f32(float %0, float %3, float %5)
ret float %6
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
scalar_t__ connect(int, struct sockaddr const *, int /*<<< orphan*/);
int /*<<< orphan*/ err_sys(char *);
void Connect(int sockfd, const struct sockaddr *addr, socklen_t len) {
  if (connect(sockfd, addr, len) < 0)
    err_sys("connect error");
}


x86 assembly (clang, -O0):
<Connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <connect@plt>
cmp    $0x0,%rax
jge    1157 <Connect+0x37>
lea    0xeae(%rip),%rdi
call   1030 <err_sys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Connect>:
push   %rax
call   1040 <connect@plt>
test   %rax,%rax
js     112d <Connect+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <err_sys@plt>

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

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [14 x i8] c"connect error\00"
define void @Connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i64 @connect(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}