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

/* Variables and functions */
unsigned char *haval224_file(unsigned char *, int /*<<< orphan*/ *);
unsigned char *hash_file_haval224(unsigned char *out, FILE *fp) {
  return haval224_file(out, fp);
}


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

x86 assembly (clang, -O2):
<hash_file_haval224>:
jmp    1030 <haval224_file@plt>

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

LLVM IR (-O2):
define i8* @hash_file_haval224(i8* %0, i32* %1) {
%3 = tail call i8* @haval224_file(i8* %0, i32* %1)
ret i8* %3
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int timeval_diff(struct timeval *start, struct timeval *end) {
  return (end->tv_sec - start->tv_sec) * 1000 +
         (end->tv_usec - start->tv_usec) / 1000;
}


x86 assembly (clang, -O0):
<timeval_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x8(%rbp),%rcx
sub    0x4(%rcx),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_diff>:
mov    (%rsi),%eax
mov    0x4(%rsi),%ecx
sub    (%rdi),%eax
imul   $0x3e8,%eax,%edx
sub    0x4(%rdi),%ecx
movslq %ecx,%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @timeval_diff(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load %struct.timeval*, %struct.timeval** %3
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
%12 = mul nsw i32 %11, 1000
%13 = load %struct.timeval*, %struct.timeval** %4
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = load %struct.timeval*, %struct.timeval** %3
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = sub nsw i32 %15, %18
%20 = sdiv i32 %19, 1000
%21 = add nsw i32 %12, %20
ret i32 %21
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @timeval_diff(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%12 = load i32, i32* %11
%13 = sub nsw i32 %10, %12
%14 = sdiv i32 %13, 1000
%15 = add nsw i32 %14, %8
ret i32 %15
}
/* Type definitions */
typedef int uint8_t;

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


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

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

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

LLVM IR (-O2):
define i32 @i2c_write_leuint08(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [5 x i32]
%6 = bitcast [5 x i32]* %5 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32 %2, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%9 = call i32 @__wleu08(i32* %8, i32 %3)
%10 = call i32 @i2c_transact(i32 %0, i32 %1, i32* %7, i32 5, i32 0)
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t avg8(uint8_t i, uint8_t j) { return (i + j) >> 1; }


x86 assembly (clang, -O0):
<avg8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sar    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<avg8>:
lea    (%rdi,%rsi,1),%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @avg8(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = ashr i32 %3, 1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_ITEM;

/* Variables and functions */
int /*<<< orphan*/ asn1_item_combine_free(int /*<<< orphan*/ **,
                                          int /*<<< orphan*/ const *,
                                          int /*<<< orphan*/);
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) {
  asn1_item_combine_free(&val, it, 0);
}


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

x86 assembly (clang, -O2):
<ASN1_item_free>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
xor    %edx,%edx
call   1030 <asn1_item_combine_free@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @ASN1_item_free(i32* %0, i32* %1) {
%3 = alloca i32*
store i32* %0, i32** %3
%4 = call i32 @asn1_item_combine_free(i32** %3, i32* %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArray(int data[], int size) {
  int i;
  for (i = 0; i < size; i++) {
    printf("%4d", data[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%4d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printArray(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%4d\00"
define void @printArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ robber_erase(int);
int /*<<< orphan*/ robber_place(int);
int robber_up(int hex) {
  robber_erase(hex);
  hex -= 5;
  if (hex == -4)
    hex = 21;
  if (hex == 0 || hex == 2)
    hex += 15;
  if (hex < 1)
    hex += 20;
  robber_place(hex);
  return hex;
}


x86 assembly (clang, -O0):
<robber_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <robber_erase@plt>
mov    -0x4(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xfffffffc,-0x4(%rbp)
jne    114d <robber_up+0x2d>
movl   $0x15,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1161 <robber_up+0x41>
cmpl   $0x2,-0x4(%rbp)
jne    116a <robber_up+0x4a>
mov    -0x4(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    117d <robber_up+0x5d>
mov    -0x4(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <robber_place@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<robber_up>:
push   %rbx
mov    %edi,%ebx
call   1040 <robber_erase@plt>
add    $0xfffffffb,%ebx
cmp    $0xfffffffc,%ebx
mov    $0x15,%eax
cmovne %ebx,%eax
lea    0xf(%rax),%ecx
test   $0xfffffffd,%eax
cmovne %eax,%ecx
lea    0x14(%rcx),%ebx
test   %ecx,%ecx
cmovg  %ecx,%ebx
mov    %ebx,%edi
call   1030 <robber_place@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @robber_up(i32 %0) {
%2 = tail call i32 @robber_erase(i32 %0)
%3 = add nsw i32 %0, -5
%4 = icmp eq i32 %3, -4
%5 = select i1 %4, i32 21, i32 %3
%6 = and i32 %5, -3
%7 = icmp eq i32 %6, 0
%8 = add nsw i32 %5, 15
%9 = select i1 %7, i32 %8, i32 %5
%10 = icmp slt i32 %9, 1
%11 = add nsw i32 %9, 20
%12 = select i1 %10, i32 %11, i32 %9
%13 = tail call i32 @robber_place(i32 %12)
ret i32 %12
}
/* Variables and functions */
short *_zero_arr_plus_short_fn(short *, int, int, char const *, unsigned int);
short *_zero_arr_inplace_plus_post_short_fn(short **x, int orig_i,
                                            const char *filename,
                                            unsigned lineno) {
  short *_zap_res = *x;
  *x = _zero_arr_plus_short_fn(_zap_res, 1, orig_i, filename, lineno);
  return _zap_res;
}


x86 assembly (clang, -O0):
<_zero_arr_inplace_plus_post_short_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    $0x1,%esi
call   1030 <_zero_arr_plus_short_fn@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_zero_arr_inplace_plus_post_short_fn>:
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <_zero_arr_plus_short_fn@plt>
mov    %rax,(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i16* @_zero_arr_inplace_plus_post_short_fn(i16** nocapture %0, i32 %1, i8* %2, i32 %3) {
%5 = load i16*, i16** %0
%6 = tail call i16* @_zero_arr_plus_short_fn(i16* %5, i32 1, i32 %1, i8* %2, i32 %3)
store i16* %6, i16** %0
ret i16* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  union symbol {
    int number;
    char letter;
  };
  union symbol value;
  value.letter = 'u';
  union symbol *pntr;
  pntr = &value;
  char myLetter = pntr->letter;
  printf("Letter Field %c\n", myLetter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movb   $0x75,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
lea    0xecc(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.symbol = type { i32 }
@.str = [17 x i8] c"Letter Field %c\0A\00"
define i32 @main() {
%1 = alloca %union.symbol
%2 = alloca %union.symbol*
%3 = alloca i8
%4 = bitcast %union.symbol* %1 to i8*
store i8 117, i8* %4
store %union.symbol* %1, %union.symbol** %2
%5 = load %union.symbol*, %union.symbol** %2
%6 = bitcast %union.symbol* %5 to i8*
%7 = load i8, i8* %6
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext %8)
ret i32 0
}

LLVM IR (-O2):
%union.symbol = type { i32 }
@.str = [17 x i8] c"Letter Field %c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext 117)
ret i32 0
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
int8_t ne_int8_t(int8_t a, int8_t b) { return a != b; }


x86 assembly (clang, -O0):
<ne_int8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ne_int8_t>:
xor    %eax,%eax
cmp    %esi,%edi
setne  %al
ret

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

LLVM IR (-O2):
define i32 @ne_int8_t(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int strlen(char *s) {
  int l = 0;
  while (*s++) {
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ realloc(char *, int /*<<< orphan*/);
void f7_realloc() {
  char *x = (char *)malloc(4);
  realloc(x, 0);
  x[0] = 'a';
}


x86 assembly (clang, -O0):
<f7_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <realloc@plt>
mov    -0x8(%rbp),%rax
movb   $0x61,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f7_realloc>:
push   %rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1040 <realloc@plt>
movb   $0x61,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @f7_realloc() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @realloc(i8* %4, i32 0)
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 97, i8* %7
ret void
}

LLVM IR (-O2):
define void @f7_realloc() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @realloc(i8* %2, i32 0)
store i8 97, i8* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void fn_test2(void) {
  static int ia, ib;
  ia++;
  ib++;
  printf("fn_test2: %d, %d\n", ia, ib);
}


x86 assembly (clang, -O0):
<fn_test2>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f12(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f09(%rip)
mov    0x2f07(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2efe(%rip)
mov    0x2ef4(%rip),%esi
mov    0x2ef2(%rip),%edx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_test2>:
mov    0x2f16(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2f0d(%rip)
mov    0x2f0b(%rip),%edx
add    $0x1,%edx
mov    %edx,0x2f02(%rip)
lea    0xecb(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@fn_test2.ia = internal global i32 0
@fn_test2.ib = internal global i32 0
@.str = [18 x i8] c"fn_test2: %d, %d\0A\00"
define void @fn_test2() {
%1 = load i32, i32* @fn_test2.ia
%2 = add nsw i32 %1, 1
store i32 %2, i32* @fn_test2.ia
%3 = load i32, i32* @fn_test2.ib
%4 = add nsw i32 %3, 1
store i32 %4, i32* @fn_test2.ib
%5 = load i32, i32* @fn_test2.ia
%6 = load i32, i32* @fn_test2.ib
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@fn_test2.ia = internal unnamed_addr global i32 0
@fn_test2.ib = internal unnamed_addr global i32 0
@.str = [18 x i8] c"fn_test2: %d, %d\0A\00"
define void @fn_test2() {
%1 = load i32, i32* @fn_test2.ia
%2 = add nsw i32 %1, 1
store i32 %2, i32* @fn_test2.ia
%3 = load i32, i32* @fn_test2.ib
%4 = add nsw i32 %3, 1
store i32 %4, i32* @fn_test2.ib
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
ret void
}
int fun961() { return 961; }


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

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

LLVM IR (-O0):
define i32 @fun961() {
ret i32 961
}

LLVM IR (-O2):
define i32 @fun961() {
ret i32 961
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *sirius_malloc(size_t size) {
  void *ret = malloc(size);
  if (NULL == ret) {
    fprintf(stderr, "malloc(%lu) failed.\n", size);
    exit(1);
  }
  return ret;
}


x86 assembly (clang, -O0):
<sirius_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1178 <sirius_malloc+0x48>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe97(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sirius_malloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <sirius_malloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"malloc(%lu) failed.\0A\00"
define i8* @sirius_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* null, %6
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"malloc(%lu) failed.\0A\00"
define noalias i8* @sirius_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
int stty(fildes, argp)
int fildes;
struct sgttyb *argp;
{
  return ioctl(fildes, 0x80067409, argp);
}


x86 assembly (clang, -O0):
<stty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0x80067409,%esi
mov    $0x0,%al
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stty>:
mov    %rsi,%rdx
mov    $0x80067409,%esi
xor    %eax,%eax
jmp    1030 <ioctl@plt>

LLVM IR (-O0):
%struct.sgttyb = type opaque
define i32 @stty(i32 %0, %struct.sgttyb* %1) {
%3 = alloca i32
%4 = alloca %struct.sgttyb*
store i32 %0, i32* %3
store %struct.sgttyb* %1, %struct.sgttyb** %4
%5 = load i32, i32* %3
%6 = load %struct.sgttyb*, %struct.sgttyb** %4
%7 = call i32 (i32, i32, %struct.sgttyb*, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, %struct.sgttyb*, ...)*)(i32 %5, i32 -2147060727, %struct.sgttyb* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.sgttyb = type opaque
define i32 @stty(i32 %0, %struct.sgttyb* %1) {
%3 = tail call i32 (i32, i32, %struct.sgttyb*, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, %struct.sgttyb*, ...)*)(i32 %0, i32 -2147060727, %struct.sgttyb* %1)
ret i32 %3
}
/* Variables and functions */
int strlen(char *);
long hash(char *word) {
  int counter;
  long hash_code = 42;
  for (counter = 0; counter < strlen(word); counter++) {
    hash_code += word[counter] * (counter + 1);
  }
  return hash_code;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x2a,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    1174 <hash+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <hash+0x1b>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    $0x2a,%r15d
test   %eax,%eax
jle    1150 <hash+0x40>
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%eax
add    $0x1,%rbx
imul   %ebx,%eax
cltq
add    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1130 <hash+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @hash(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %18
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i64 [ %14, %4 ], [ 42, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = sext i8 %8 to i64
%10 = add nuw nsw i64 %5, 1
%11 = mul i64 %10, %9
%12 = shl i64 %11, 32
%13 = ashr exact i64 %12, 32
%14 = add nsw i64 %6, %13
%15 = tail call i32 @strlen(i8* %0)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %10, %16
br i1 %17, label %4, label %18
18: ; preds = %4, %1
%19 = phi i64 [ 42, %1 ], [ %14, %4 ]
ret i64 %19
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void deal_with(int signum) { printf("hello world\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define void @deal_with(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define void @deal_with(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
void outportb(unsigned int port, unsigned char value) {
  asm volatile("outb %%al,%%dx;outb %%al,$0x80" ::"d"(port), "a"(value));
}


x86 assembly (clang, -O0):
<outportb>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x5(%rbp),%al
out    %al,(%dx)
out    %al,$0x80
pop    %rbp
ret

x86 assembly (clang, -O2):
<outportb>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
out    %al,$0x80
ret

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

LLVM IR (-O2):
define void @outportb(i32 %0, i8 zeroext %1) {
tail call void asm sideeffect "outb %al,%dx;outb %al,$$0x80", "{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %0, i8 %1)
ret void
}
int softmagic(buf, nbytes)
unsigned char *buf;
int nbytes;
{
  if (match(buf, nbytes))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<softmagic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1030 <match@plt>
cmp    $0x0,%eax
je     1142 <softmagic+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <softmagic+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @softmagic(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @match to i32 (i8*, i32, ...)*)(i8* %0, i32 %1)
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
__attribute__((always_)) void reset_lazy_tlbstate(void) {}


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

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

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

LLVM IR (-O2):
define void @reset_lazy_tlbstate() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void func4() {
  print("wait to turn on alarm \n in beginning from \nlaser disturbed bugler");
}


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

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

LLVM IR (-O0):
@.str = [66 x i8] c"wait to turn on alarm \0A in beginning from \0Alaser disturbed bugler\00"
define void @func4() {
%1 = call i32 @print(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"wait to turn on alarm \0A in beginning from \0Alaser disturbed bugler\00"
define void @func4() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int string_array_pos(char **, size_t, char const *);
int is_in_string_array(char *array[], size_t len, const char item[]) {
  const int pos = string_array_pos(array, len, item);
  return pos >= 0;
}


x86 assembly (clang, -O0):
<is_in_string_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <string_array_pos@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_string_array>:
push   %rax
call   1030 <string_array_pos@plt>
not    %eax
shr    $0x1f,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_in_string_array(i8** %0, i64 %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
store i8** %0, i8*** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%8 = load i8**, i8*** %4
%9 = load i64, i64* %5
%10 = load i8*, i8** %6
%11 = call i32 @string_array_pos(i8** %8, i64 %9, i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp sge i32 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @is_in_string_array(i8** %0, i64 %1, i8* %2) {
%4 = tail call i32 @string_array_pos(i8** %0, i64 %1, i8* %2)
%5 = xor i32 %4, -1
%6 = lshr i32 %5, 31
ret i32 %6
}
/* Variables and functions */
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sys_bashfilename(char const *, char *);
int check_exists(const char *path) {
  char pathbuf[1000];
  sys_bashfilename(path, pathbuf);
  return (0 == access(pathbuf, 0));
}


x86 assembly (clang, -O0):
<check_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x3f0(%rbp),%rsi
call   1030 <sys_bashfilename@plt>
lea    -0x3f0(%rbp),%rdi
xor    %esi,%esi
call   1040 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_exists>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <sys_bashfilename@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @check_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca [1000 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @sys_bashfilename(i8* %4, i8* %5)
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%8 = call i64 @access(i8* %7, i32 0)
%9 = icmp eq i64 0, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @check_exists(i8* %0) {
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%4 = call i32 @sys_bashfilename(i8* %0, i8* %3)
%5 = call i64 @access(i8* %3, i32 0)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_second_greetings(void) { printf("Hello from UNPATCHED binary\n"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Hello from UNPATCHED binary\0A\00"
define void @print_second_greetings() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"Hello from UNPATCHED binary\00"
define void @print_second_greetings() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret void
}
void eglGetCurrentSurface(void) { return; }


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

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

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

LLVM IR (-O2):
define void @eglGetCurrentSurface() {
ret void
}
/* Variables and functions */
int m(char *, int volatile, long volatile);
int call(int pi, long pj) {
  volatile int ic = pi - 42;
  volatile long jc = pj + 42;
  return m("call", ic, jc);
}


x86 assembly (clang, -O0):
<call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x2a,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2a,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xebe(%rip),%rdi
call   1030 <m@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call>:
add    $0xffffffd6,%edi
mov    %edi,-0xc(%rsp)
add    $0x2a,%rsi
mov    %rsi,-0x8(%rsp)
mov    -0xc(%rsp),%esi
mov    -0x8(%rsp),%rdx
lea    0xed0(%rip),%rdi
jmp    1030 <m@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"call\00"
define i32 @call(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 42
store volatile i32 %8, i32* %5
%9 = load i64, i64* %4
%10 = add nsw i64 %9, 42
store volatile i64 %10, i64* %6
%11 = load volatile i32, i32* %5
%12 = load volatile i64, i64* %6
%13 = call i32 @m(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %11, i64 %12)
ret i32 %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"call\00"
define i32 @call(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = bitcast i32* %3 to i8*
%6 = add nsw i32 %0, -42
store volatile i32 %6, i32* %3
%7 = bitcast i64* %4 to i8*
%8 = add nsw i64 %1, 42
store volatile i64 %8, i64* %4
%9 = load volatile i32, i32* %3
%10 = load volatile i64, i64* %4
%11 = tail call i32 @m(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9, i64 %10)
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int /*<<< orphan*/);
void handler(int signum) {
  close(STDOUT_FILENO);
  (void)signum;
}


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

x86 assembly (clang, -O2):
<handler>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <close@plt>

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

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
define void @handler(i32 %0) {
%2 = load i32, i32* @STDOUT_FILENO
%3 = tail call i32 @close(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strndup(char const *, int);
void updatestring(void *old, const char *new) {
  char *temp = *((char **)old);
  *((char **)old) = strndup(new, 4095);
  if (temp != NULL) {
    free(temp);
  }
}


x86 assembly (clang, -O0):
<updatestring>:
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),%rdi
mov    $0xfff,%esi
call   1040 <strndup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1167 <updatestring+0x47>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<updatestring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %rsi,%rdi
mov    $0xfff,%esi
call   1040 <strndup@plt>
mov    %rax,(%rbx)
test   %r14,%r14
je     114e <updatestring+0x2e>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @updatestring(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %7
store i8* %8, i8** %5
%9 = load i8*, i8** %4
%10 = call i8* @strndup(i8* %9, i32 4095)
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to i8**
store i8* %10, i8** %12
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i8*, i8** %5
%17 = call i32 @free(i8* %16)
br label %18
18: ; preds = %15, %2
ret void
}

LLVM IR (-O2):
define void @updatestring(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = tail call i8* @strndup(i8* %1, i32 4095)
store i8* %5, i8** %3
%6 = icmp eq i8* %4, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @free(i8* %4)
br label %9
9: ; preds = %7, %2
ret void
}
int callfunc(int (*funcp)(void)) { return funcp() * 2; }


x86 assembly (clang, -O0):
<callfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
call   *-0x8(%rbp)
shl    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callfunc>:
push   %rax
call   *%rdi
add    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @callfunc(i32 ()* nocapture %0) {
%2 = tail call i32 %0()
%3 = shl nsw i32 %2, 1
ret i32 %3
}
int f4(int y, int x) {
  int a = x & y;
  return a | x;
}


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

x86 assembly (clang, -O2):
<f4>:
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @f4(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = and i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = or i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @f4(i32 %0, i32 returned %1) {
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ hdestroy();
void hash_table_destroy() { hdestroy(); }


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

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

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

LLVM IR (-O2):
define void @hash_table_destroy() {
%1 = tail call i32 (...) @hdestroy()
ret void
}
void __attribute__((weak)) __init_hardware(void) {}


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

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

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

LLVM IR (-O2):
define weak void @__init_hardware() {
ret void
}
int BKDRHash(char const *key) {
  unsigned int seed = 131;
  int hash = 0;
  while ('\0' != *key)
    hash = hash * seed + *key++;
  return hash & (0x7fffffffl);
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x83,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     114a <BKDRHash+0x4a>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <BKDRHash+0x16>
movslq -0x10(%rbp),%rax
and    $0x7fffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <BKDRHash+0x2c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
imul   $0x83,%eax,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @BKDRHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 131
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = add i32 %9, %8
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
void stubthunk_call_test(void *stub) {
  __asm__ __volatile("call *%0\n\t" : : "r"(stub) :);
}


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

x86 assembly (clang, -O2):
<stubthunk_call_test>:
call   *%rdi
ret

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

LLVM IR (-O2):
define void @stubthunk_call_test(i8* %0) {
tail call void asm sideeffect "call *$0\0A\09", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Variables and functions */
char *strcpy(char *, char const *);
char *wsh_strcpy(char *dest, const char *src) { return strcpy(dest, src); }


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

x86 assembly (clang, -O2):
<wsh_strcpy>:
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @wsh_strcpy(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 = load i8*, i8** %4
%7 = call i8* @strcpy(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @wsh_strcpy(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}