xunge/DecIR huggingface dataset:
int shlib_visibility_func_weak() { return 1; }


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

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

LLVM IR (-O0):
define i32 @shlib_visibility_func_weak() {
ret i32 1
}

LLVM IR (-O2):
define i32 @shlib_visibility_func_weak() {
ret i32 1
}
int als_disable(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @als_disable() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMRE7_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRE7_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMRE7_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ printf(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int socket_desc;
  socket_desc = socket(AF_INET, SOCK_STREAM, 0);
  if (socket_desc == -1) {
    printf("Could not create socket");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1168 <main+0x48>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
cmp    $0xffffffff,%eax
jne    114b <main+0x2b>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"Could not create socket\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
%7 = load i32, i32* @AF_INET
%8 = load i32, i32* @SOCK_STREAM
%9 = call i32 @socket(i32 %7, i32 %8, i32 0)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
ret i32 0
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"Could not create socket\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_STREAM
%5 = tail call i32 @socket(i32 %3, i32 %4, i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void PRFree(void *ptr) {
  ;
  free(ptr);
  ;
  return;
}


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

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

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

LLVM IR (-O2):
define void @PRFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ REG_UART_BASE(scalar_t__);
__attribute__((always_)) __attribute__((flatten)) uint32_t
UART_CLKDIV(uint32_t i) {
  return (REG_UART_BASE(i) + 0x14);
}


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

x86 assembly (clang, -O2):
<UART_CLKDIV>:
push   %rax
call   1030 <REG_UART_BASE@plt>
add    $0x14,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @UART_CLKDIV(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @REG_UART_BASE(i64 %3)
%5 = add nsw i64 %4, 20
ret i64 %5
}

LLVM IR (-O2):
define i64 @UART_CLKDIV(i64 %0) {
%2 = tail call i64 @REG_UART_BASE(i64 %0)
%3 = add nsw i64 %2, 20
ret i64 %3
}
double FDLIBM_fabs(double x) {
  *(1 + (int *)&x) &= 0x7fffffff;
  return x;
}


x86 assembly (clang, -O0):
<FDLIBM_fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FDLIBM_fabs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @FDLIBM_fabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = bitcast double* %2 to i32*
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, 2147483647
store i32 %6, i32* %4
%7 = load double, double* %2
ret double %7
}

LLVM IR (-O2):
define double @FDLIBM_fabs(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, 9223372036854775807
%4 = bitcast i64 %3 to double
ret double %4
}
void llist_copy() {}


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

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

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

LLVM IR (-O2):
define void @llist_copy() {
ret void
}
void __SLIC_fun_local_irq_disable_call(void) {
  { return; }
}


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

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

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

LLVM IR (-O2):
define void @__SLIC_fun_local_irq_disable_call() {
ret void
}
long long_fetch_sub_consume(long *ptr, long value) {
  return __atomic_fetch_sub(ptr, value, 1);
}


x86 assembly (clang, -O0):
<long_fetch_sub_consume>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
neg    %rax
lock xadd %rax,(%rcx)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_fetch_sub_consume>:
mov    %rsi,%rax
neg    %rax
lock xadd %rax,(%rdi)
ret

LLVM IR (-O0):
define i64 @long_fetch_sub_consume(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%7 = load i64*, i64** %3
%8 = load i64, i64* %4
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = atomicrmw sub i64* %7, i64 %9 acquire
store i64 %10, i64* %6
%11 = load i64, i64* %6
ret i64 %11
}

LLVM IR (-O2):
define i64 @long_fetch_sub_consume(i64* nocapture %0, i64 %1) {
%3 = atomicrmw sub i64* %0, i64 %1 acquire
ret i64 %3
}
float Distance(int i, int j, float **delta) {
  if (i > j)
    return (delta[i][j]);
  else
    return (delta[j][i]);
}


x86 assembly (clang, -O0):
<Distance>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1139 <Distance+0x39>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1153 <Distance+0x53>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Distance>:
cmp    %esi,%edi
mov    %esi,%eax
cmovg  %edi,%eax
cmovg  %esi,%edi
cltq
mov    (%rdx,%rax,8),%rax
movslq %edi,%rcx
movss  (%rax,%rcx,4),%xmm0
ret

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

LLVM IR (-O2):
define float @Distance(i32 %0, i32 %1, float** nocapture %2) {
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %0, i32 %1
%6 = select i1 %4, i32 %1, i32 %0
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds float*, float** %2, i64 %7
%9 = load float*, float** %8
%10 = sext i32 %6 to i64
%11 = getelementptr inbounds float, float* %9, i64 %10
%12 = load float, float* %11
ret float %12
}
int str_len(char s[]) {
  int i = 0;
  while (s[i] != '\0')
    i++;
  return i;
}


x86 assembly (clang, -O0):
<str_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <str_len+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <str_len+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @str_len(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ write(char *, char *, int /*<<< orphan*/ *);
void post_task() { write("json-task.json", "}\n", NULL); }


x86 assembly (clang, -O0):
<post_task>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<post_task>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
xor    %edx,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"json-task.json\00"
@.str.1 = [3 x i8] c"}\0A\00"
define void @post_task() {
%1 = call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"json-task.json\00"
@.str.1 = [3 x i8] c"}\0A\00"
define void @post_task() {
%1 = tail call i32 @write(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
void avlInit(void) {
  ;
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @avlInit() {
ret void
}
unsigned bitScan_fun_uchar(unsigned char x) {
  unsigned r = 8;
  while (x) {
    --r;
    x >>= 1;
  }
  return r;
}


x86 assembly (clang, -O0):
<bitScan_fun_uchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x8,-0x8(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     1133 <bitScan_fun_uchar+0x33>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
jmp    1111 <bitScan_fun_uchar+0x11>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitScan_fun_uchar>:
mov    $0x8,%eax
test   %edi,%edi
je     111d <bitScan_fun_uchar+0x1d>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%eax
shr    %cl
cmp    $0x1,%dil
mov    %ecx,%edi
ja     1110 <bitScan_fun_uchar+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitScan_fun_uchar(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 8, %1 ]
%5 = phi i8 [ %7, %3 ], [ %0, %1 ]
%6 = add nsw i32 %4, -1
%7 = lshr i8 %5, 1
%8 = icmp ult i8 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 8, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void handler(int sig) {
  printf("receive the server signal,exit\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"receive the server signal,exit\0A\00"
@EXIT_SUCCESS = global i32 0
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [31 x i8] c"receive the server signal,exit\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void alt(void) {}


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

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

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

LLVM IR (-O2):
define void @alt() {
ret void
}
double rint(double num) {
  if (num > 0) {
    return (double)(int)(num + 0.5);
  } else {
    return (double)(int)(num + -0.5);
  }
}


x86 assembly (clang, -O0):
<rint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    113a <rint+0x3a>
movsd  0xee5(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1154 <rint+0x54>
movsd  0xebe(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rint>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @rint(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load double, double* %3
%8 = fadd double %7, 5.000000e-01
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to double
store double %10, double* %2
br label %16
11: ; preds = %1
%12 = load double, double* %3
%13 = fadd double %12, -5.000000e-01
%14 = fptosi double %13 to i32
%15 = sitofp i32 %14 to double
store double %15, double* %2
br label %16
16: ; preds = %11, %6
%17 = load double, double* %2
ret double %17
}

LLVM IR (-O2):
define double @rint(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = select i1 %2, double 5.000000e-01, double -5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
%6 = sitofp i32 %5 to double
ret double %6
}
/* Variables and functions */
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main(void) {
  char buffer[4096];
  while (get_line(buffer, stdin))
    printf("%s\r\n", buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     1169 <main+0x49>
lea    -0x1010(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1000,%rsp
mov    0x2eb5(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     116b <main+0x4b>
lea    0xeb6(%rip),%r14
mov    %rsp,%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"%s\0D\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i64 @get_line(i8* %4, i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %3
11: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [5 x i8] c"%s\0D\0A\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @get_line(i8* %2, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %0, %6
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = load i32, i32* @stdin
%9 = call i64 @get_line(i8* %2, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %0
ret i32 0
}
int getCount(int n) {
  if (n == 0) {
    return 0;
  } else if (n % 2 == 1) {
    return 1 + getCount(n - 1);
  } else {
    return 1 + getCount(n / 2);
  }
}


x86 assembly (clang, -O0):
<getCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <getCount+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1173 <getCount+0x63>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    115b <getCount+0x4b>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <getCount@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <getCount+0x63>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <getCount@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCount>:
push   %rbx
test   %edi,%edi
je     113f <getCount+0x2f>
mov    %edi,%eax
mov    $0xffffffff,%ebx
mov    %edi,%ecx
xchg   %ax,%ax
mov    %ecx,%edi
shr    $0x1f,%edi
add    %ecx,%edi
mov    %edi,%edx
and    $0xfffffffe,%edx
mov    %ecx,%esi
sub    %edx,%esi
cmp    $0x1,%esi
jne    1143 <getCount+0x33>
add    $0xffffffff,%ebx
add    $0xffffffff,%ecx
jne    1120 <getCount+0x10>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
sar    %edi
call   1030 <getCount@plt>
sub    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @getCount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1, %9
%4 = phi i32 [ %10, %9 ], [ %0, %1 ]
%5 = phi i32 [ %11, %9 ], [ 0, %1 ]
%6 = srem i32 %4, 2
%7 = sdiv i32 %4, 2
%8 = icmp eq i32 %6, 1
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = add nsw i32 %4, -1
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %10, 0
br i1 %12, label %13, label %3
13: ; preds = %9, %1, %15
%14 = phi i32 [ %18, %15 ], [ 0, %1 ], [ %0, %9 ]
ret i32 %14
15: ; preds = %3
%16 = tail call i32 @getCount(i32 %7)
%17 = add nuw i32 %5, 1
%18 = add i32 %17, %16
br label %13
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
ssize_t getrandom(void *buffer, size_t length, unsigned int flags) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<getrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrandom>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @getrandom(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
%8 = call i32 @__set_errno(i32 %7)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @getrandom(i8* nocapture readnone %0, i64 %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
%5 = tail call i32 @__set_errno(i32 %4)
ret i32 -1
}
/* Variables and functions */
scalar_t__ getenv(char *);
scalar_t__ gzread;
int main(int argc, char **argv) {
  char (*f)() = (char (*)())gzread;
  if (getenv("TEST_FAKENOZLIB")) {
    return 1;
  }
  return f != (char (*)())gzread;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1156 <main+0x46>
movl   $0x1,-0x4(%rbp)
jmp    1172 <main+0x62>
mov    -0x18(%rbp),%rax
mov    0x2e7f(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@gzread = global i64 0
@.str = [16 x i8] c"TEST_FAKENOZLIB\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8 (...)*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i64, i64* @gzread
%8 = inttoptr i64 %7 to i8 (...)*
store i8 (...)* %8, i8 (...)** %6
%9 = call i64 @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %18
12: ; preds = %2
%13 = load i8 (...)*, i8 (...)** %6
%14 = load i64, i64* @gzread
%15 = inttoptr i64 %14 to i8 (...)*
%16 = icmp ne i8 (...)* %13, %15
%17 = zext i1 %16 to i32
store i32 %17, i32* %3
br label %18
18: ; preds = %12, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@gzread = global i64 0
@.str = [16 x i8] c"TEST_FAKENOZLIB\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
unsigned hex_val(char ch) {
  if ('0' <= ch && ch <= '9')
    return ch - '0';
  if ('A' <= ch && ch <= 'Z')
    return ch - 'A' + 10;
  else
    return ch - 'a' + 10;
}


x86 assembly (clang, -O0):
<hex_val>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1137 <hex_val+0x37>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1137 <hex_val+0x37>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hex_val+0x74>
movsbl -0x5(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     1167 <hex_val+0x67>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1167 <hex_val+0x67>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hex_val+0x74>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_val>:
lea    -0x30(%rdi),%eax
lea    -0x41(%rdi),%ecx
xor    %edx,%edx
cmp    $0x1a,%cl
setb   %dl
shl    $0x5,%edx
add    $0xffffffa9,%edx
cmp    $0xa,%al
mov    $0xffffffd0,%eax
cmovae %edx,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @hex_val(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sle i32 48, %5
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %33
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sle i32 65, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 90
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 65
%27 = add nsw i32 %26, 10
store i32 %27, i32* %2
br label %33
28: ; preds = %19, %15
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 97
%32 = add nsw i32 %31, 10
store i32 %32, i32* %2
br label %33
33: ; preds = %28, %23, %11
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @hex_val(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
%5 = add i8 %0, -65
%6 = icmp ult i8 %5, 26
%7 = select i1 %6, i32 -55, i32 -87
%8 = select i1 %4, i32 -48, i32 %7
%9 = add nsw i32 %8, %2
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ cs_high();
int sdmmc_cmd(int, int /*<<< orphan*/);
int spi(int);
int sdmmc_stop_transmission() {
  int result;
  if ((result = sdmmc_cmd(12, 0)) < 0) {
    while (spi(0xff) != 0xff)
      ;
    cs_high();
    return result;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sdmmc_stop_transmission>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
xor    %esi,%esi
call   1050 <sdmmc_cmd@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    1181 <sdmmc_stop_transmission+0x51>
jmp    1155 <sdmmc_stop_transmission+0x25>
mov    $0xff,%edi
call   1040 <spi@plt>
cmp    $0xff,%eax
je     116f <sdmmc_stop_transmission+0x3f>
jmp    1155 <sdmmc_stop_transmission+0x25>
mov    $0x0,%al
call   1030 <cs_high@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1188 <sdmmc_stop_transmission+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdmmc_stop_transmission>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
mov    $0xc,%edi
xor    %esi,%esi
call   1050 <sdmmc_cmd@plt>
test   %eax,%eax
jns    116a <sdmmc_stop_transmission+0x3a>
mov    %eax,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xff,%edi
call   1040 <spi@plt>
cmp    $0xff,%eax
jne    1150 <sdmmc_stop_transmission+0x20>
xor    %eax,%eax
call   1030 <cs_high@plt>
mov    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sdmmc_stop_transmission() {
%1 = tail call i32 @sdmmc_cmd(i32 12, i32 0)
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0, %3
%4 = tail call i32 @spi(i32 255)
%5 = icmp eq i32 %4, 255
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = tail call i32 (...) @cs_high()
br label %8
8: ; preds = %0, %6
%9 = phi i32 [ %1, %6 ], [ 0, %0 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ is_hex(char *);
char *is_hex_02a() {
  char phrase[] = "foo bar is not hex";
  do {
    if (!(!is_hex(phrase)))
      return "return false for non-hex strings";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<is_hex_02a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xed3(%rip),%al
mov    %al,-0xe(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <is_hex@plt>
cmp    $0x0,%eax
je     1164 <is_hex_02a+0x54>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1171 <is_hex_02a+0x61>
jmp    1169 <is_hex_02a+0x59>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_hex_02a>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x786568,0xf(%rsp)
mov    %rsp,%rdi
call   1030 <is_hex@plt>
xor    %ecx,%ecx
test   %eax,%eax
lea    0xed9(%rip),%rax
cmovne %rax,%rcx
mov    %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.is_hex_02a.phrase = [19 x i8] c"foo bar is not hex\00"
@.str = [33 x i8] c"return false for non-hex strings\00"
define i8* @is_hex_02a() {
%1 = alloca i8*
%2 = alloca [19 x i8]
%3 = bitcast [19 x i8]* %2 to i8*
br label %4
4: ; preds = %0
%5 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%6 = call i32 @is_hex(i8* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8** %1
br label %11
9: ; preds = %4
br label %10
10: ; preds = %9
store i8* null, i8** %1
br label %11
11: ; preds = %10, %8
%12 = load i8*, i8** %1
ret i8* %12
}

LLVM IR (-O2):
@__const.is_hex_02a.phrase = [19 x i8] c"foo bar is not hex\00"
@.str = [33 x i8] c"return false for non-hex strings\00"
define i8* @is_hex_02a() {
%1 = alloca [19 x i8]
%2 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 0
%3 = call i32 @is_hex(i8* %2)
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8* null, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ puts(char *);
void usage(const char *proc_name) {
  printf("%s -edh <argument>\n", proc_name);
  puts("-e encode a string");
  puts("-d decode a string");
  puts("-h help");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeeb(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%s -edh <argument>\0A\00"
@.str.1 = [19 x i8] c"-e encode a string\00"
@.str.2 = [19 x i8] c"-d decode a string\00"
@.str.3 = [8 x i8] c"-h help\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s -edh <argument>\0A\00"
@.str.1 = [19 x i8] c"-e encode a string\00"
@.str.2 = [19 x i8] c"-d decode a string\00"
@.str.3 = [8 x i8] c"-h help\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int peek(FILE *in) {
  int c = getc(in);
  ungetc(c, in);
  return c;
}


x86 assembly (clang, -O0):
<peek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1030 <ungetc@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peek>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <ungetc@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @peek(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = tail call i32 @ungetc(i32 %2, i32* %0)
ret i32 %2
}
char *easy_string_tolower(char *str) {
  char *p = str;
  while (*p) {
    if ((*p) >= 'A' && (*p) <= 'Z')
      (*p) += 32;
    p++;
  }
  return str;
}


x86 assembly (clang, -O0):
<easy_string_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115a <easy_string_tolower+0x5a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1149 <easy_string_tolower+0x49>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     1149 <easy_string_tolower+0x49>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
add    $0x20,%ecx
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <easy_string_tolower+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<easy_string_tolower>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     112c <easy_string_tolower+0x2c>
lea    0x1(%rax),%rdx
jmp    111b <easy_string_tolower+0x1b>
nop
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
je     112c <easy_string_tolower+0x2c>
lea    -0x41(%rcx),%esi
cmp    $0x19,%sil
ja     1110 <easy_string_tolower+0x10>
add    $0x20,%cl
mov    %cl,-0x1(%rdx)
jmp    1110 <easy_string_tolower+0x10>
ret

LLVM IR (-O0):
define i8* @easy_string_tolower(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 = %25, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %28
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %25
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 90
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = add nsw i32 %22, 32
%24 = trunc i32 %23 to i8
store i8 %24, i8* %20
br label %25
25: ; preds = %19, %14, %9
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
br label %5
28: ; preds = %5
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
define i8* @easy_string_tolower(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -65
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nuw nsw i8 %5, 32
store i8 %10, i8* %6
br label %11
11: ; preds = %9, %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *smalloc(size_t);
void *zmalloc(size_t s) {
  void *p = smalloc(s);
  if (p)
    memset(p, 0, s);
  return p;
}


x86 assembly (clang, -O0):
<zmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <smalloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1153 <zmalloc+0x33>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <smalloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1141 <zmalloc+0x21>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @zmalloc(i64 %0) {
%2 = tail call i8* @smalloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
long eatbyte(unsigned char *data, char *output) {
  sprintf(output, "db 0x%02X", *data);
  return 1;
}


x86 assembly (clang, -O0):
<eatbyte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
lea    0xed1(%rip),%rsi
movzbl (%rax),%edx
call   1030 <sprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eatbyte>:
push   %rax
mov    %rsi,%rax
movzbl (%rdi),%edx
lea    0xee2(%rip),%rsi
mov    %rax,%rdi
call   1030 <sprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"db 0x%02X\00"
define i64 @eatbyte(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 zeroext %7)
ret i64 1
}

LLVM IR (-O2):
@.str = [10 x i8] c"db 0x%02X\00"
define i64 @eatbyte(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 zeroext %3)
ret i64 1
}
/* Type definitions */
struct bst_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ chainsaw(struct bst_node *);
void bst_dealloc(struct bst_node *tree) { chainsaw(tree); }


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

x86 assembly (clang, -O2):
<bst_dealloc>:
jmp    1030 <chainsaw@plt>

LLVM IR (-O0):
%struct.bst_node = type { i32 }
define void @bst_dealloc(%struct.bst_node* %0) {
%2 = alloca %struct.bst_node*
store %struct.bst_node* %0, %struct.bst_node** %2
%3 = load %struct.bst_node*, %struct.bst_node** %2
%4 = call i32 @chainsaw(%struct.bst_node* %3)
ret void
}

LLVM IR (-O2):
%struct.bst_node = type { i32 }
define void @bst_dealloc(%struct.bst_node* %0) {
%2 = tail call i32 @chainsaw(%struct.bst_node* %0)
ret void
}
/* Variables and functions */
scalar_t__ strtol(char const *, int /*<<< orphan*/, int);
int atoi(const char *str) { return (int)strtol(str, 0, 10); }


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

x86 assembly (clang, -O2):
<atoi>:
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtol@plt>

LLVM IR (-O0):
define i32 @atoi(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strtol(i8* %3, i32 0, i32 10)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @atoi(i8* %0) {
%2 = tail call i64 @strtol(i8* %0, i32 0, i32 10)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned int fgetc(int /*<<< orphan*/ *);
unsigned int getid(FILE *f) {
  unsigned int id;
  id = fgetc(f);
  id = (id << 8) | fgetc(f);
  id = (id << 8) | fgetc(f);
  id = (id << 8) | fgetc(f);
  return id;
}


x86 assembly (clang, -O0):
<getid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getid>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
shl    $0x10,%ebp
shl    $0x8,%ebx
or     %ebp,%ebx
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
or     %ebx,%ebp
shl    $0x8,%ebp
mov    %r14,%rdi
call   1030 <fgetc@plt>
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getid(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fgetc(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = call i32 @fgetc(i32* %8)
%10 = or i32 %7, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = shl i32 %11, 8
%13 = load i32*, i32** %2
%14 = call i32 @fgetc(i32* %13)
%15 = or i32 %12, %14
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = shl i32 %16, 8
%18 = load i32*, i32** %2
%19 = call i32 @fgetc(i32* %18)
%20 = or i32 %17, %19
store i32 %20, i32* %3
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @getid(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = tail call i32 @fgetc(i32* %0)
%4 = shl i32 %2, 16
%5 = shl i32 %3, 8
%6 = or i32 %5, %4
%7 = tail call i32 @fgetc(i32* %0)
%8 = or i32 %6, %7
%9 = shl i32 %8, 8
%10 = tail call i32 @fgetc(i32* %0)
%11 = or i32 %9, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ k_error(char *);
void bt_key_count() { k_error("Incorrect number of BTree keys"); }


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"Incorrect number of BTree keys\00"
define void @bt_key_count() {
%1 = call i32 @k_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Incorrect number of BTree keys\00"
define void @bt_key_count() {
%1 = tail call i32 @k_error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}
long return_64() { return 0xffffffff1; }


x86 assembly (clang, -O0):
<return_64>:
push   %rbp
mov    %rsp,%rbp
movabs $0xffffffff1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_64>:
movabs $0xffffffff1,%rax
ret

LLVM IR (-O0):
define i64 @return_64() {
ret i64 68719476721
}

LLVM IR (-O2):
define i64 @return_64() {
ret i64 68719476721
}
/* Variables and functions */
int /*<<< orphan*/ findSolution(unsigned int const);
int /*<<< orphan*/ print(unsigned int const);
int main(void) {
  const unsigned n = 5;
  findSolution(n);
  print(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    $0x5,%edi
call   1040 <findSolution@plt>
mov    $0x5,%edi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <findSolution@plt>
mov    $0x5,%edi
call   1030 <print@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = call i32 @findSolution(i32 5)
%4 = call i32 @print(i32 5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @findSolution(i32 5)
%2 = tail call i32 @print(i32 5)
ret i32 0
}