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

/* Variables and functions */
int /*<<< orphan*/ cnfImprt(char *const, int, char *);
int /*<<< orphan*/ msgSetk(char *, int /*<<< orphan*/);
int /*<<< orphan*/ starFree(char *);
char *starMallocAtomic(int);
void msg_setk_(char *const TOKEN, int64_t *const IVALUE, int TOKEN_length) {
  int64_t ivalue;
  char *token;
  ;
  ivalue = *IVALUE;
  token = starMallocAtomic(TOKEN_length + 1);
  cnfImprt(TOKEN, TOKEN_length, token);
  msgSetk(token, ivalue);
  starFree(token);
}


x86 assembly (clang, -O0):
<msg_setk_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1040 <starMallocAtomic@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1060 <cnfImprt@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1050 <msgSetk@plt>
mov    -0x20(%rbp),%rdi
call   1030 <starFree@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_setk_>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
mov    (%rsi),%r15d
lea    0x1(%rbx),%edi
call   1040 <starMallocAtomic@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1060 <cnfImprt@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
call   1050 <msgSetk@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <starFree@plt>

LLVM IR (-O0):
define void @msg_setk_(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
store i32 %10, i32* %7
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
%13 = call i8* @starMallocAtomic(i32 %12)
store i8* %13, i8** %8
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = load i8*, i8** %8
%17 = call i32 @cnfImprt(i8* %14, i32 %15, i8* %16)
%18 = load i8*, i8** %8
%19 = load i32, i32* %7
%20 = call i32 @msgSetk(i8* %18, i32 %19)
%21 = load i8*, i8** %8
%22 = call i32 @starFree(i8* %21)
ret void
}

LLVM IR (-O2):
define void @msg_setk_(i8* %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = add nsw i32 %2, 1
%6 = tail call i8* @starMallocAtomic(i32 %5)
%7 = tail call i32 @cnfImprt(i8* %0, i32 %2, i8* %6)
%8 = tail call i32 @msgSetk(i8* %6, i32 %4)
%9 = tail call i32 @starFree(i8* %6)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int chg_length;
};
typedef TYPE_1__ XIMPreeditDrawCallbackStruct;

/* Variables and functions */
void set_XIMPreeditDrawCallbackStruct_chg_length(void *_p, int _v) {
  ((XIMPreeditDrawCallbackStruct *)_p)->chg_length = (int)_v;
}


x86 assembly (clang, -O0):
<set_XIMPreeditDrawCallbackStruct_chg_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XIMPreeditDrawCallbackStruct_chg_length>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_XIMPreeditDrawCallbackStruct_chg_length(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ indirect2(char *);
int /*<<< orphan*/ print_string(char *);
void indirect(char c[]) {
  c[0] = 'f';
  print_string(c);
  indirect2(c);
}


x86 assembly (clang, -O0):
<indirect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x66,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <print_string@plt>
mov    -0x8(%rbp),%rdi
call   1040 <indirect2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indirect>:
push   %rbx
mov    %rdi,%rbx
movb   $0x66,(%rdi)
call   1030 <print_string@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <indirect2@plt>

LLVM IR (-O0):
define void @indirect(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 102, i8* %4
%5 = load i8*, i8** %2
%6 = call i32 @print_string(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @indirect2(i8* %7)
ret void
}

LLVM IR (-O2):
define void @indirect(i8* %0) {
store i8 102, i8* %0
%2 = tail call i32 @print_string(i8* %0)
%3 = tail call i32 @indirect2(i8* %0)
ret void
}
void usb_init(unsigned int bits, unsigned int parity, unsigned int stopBits,
              unsigned int baud) {}


x86 assembly (clang, -O0):
<usb_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @usb_init(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @usb_init(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vdp_putchar(char);
void vdp_putstring(char *s) {
  do {
    vdp_putchar(*s);
  } while (*++s);
}


x86 assembly (clang, -O0):
<vdp_putstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <vdp_putchar@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,0x1(%rax)
jne    111c <vdp_putstring+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vdp_putstring>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <vdp_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <vdp_putstring+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @vdp_putstring(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %3, %1
%4 = phi i8 [ %2, %1 ], [ %8, %3 ]
%5 = phi i8* [ %0, %1 ], [ %7, %3 ]
%6 = tail call i32 @vdp_putchar(i8 signext %4)
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
void rnd_srand(unsigned int seed, int *g_seed) { *g_seed = seed; }


x86 assembly (clang, -O0):
<rnd_srand>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd_srand>:
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @rnd_srand(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
store i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @rnd_srand(i32 %0, i32* nocapture writeonly %1) {
store i32 %0, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("I am running a null test.\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [26 x i8] c"I am running a null test.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ fill_rule;
};
typedef TYPE_1__ XGCValues;

/* Variables and functions */
int get_XGCValues_fill_rule(void *_p) {
  return (int)((XGCValues *)_p)->fill_rule;
}


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

x86 assembly (clang, -O2):
<get_XGCValues_fill_rule>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_XGCValues_fill_rule(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
double ceil(double x) {
  int y = (int)x;
  y++;
  return (double)y;
}


x86 assembly (clang, -O0):
<ceil>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil>:
cvttsd2si %xmm0,%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ret

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

LLVM IR (-O2):
define double @ceil(double %0) {
%2 = fptosi double %0 to i32
%3 = add nsw i32 %2, 1
%4 = sitofp i32 %3 to double
ret double %4
}
void Scale() {}


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

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

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

LLVM IR (-O2):
define void @Scale() {
ret void
}
/* Variables and functions */
void *a16(int);
void *a15(int x) { return (((x >> 15) & 1) ? a16(x) : a16(x)); }


x86 assembly (clang, -O0):
<a15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xf,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113e <a15+0x2e>
mov    -0x4(%rbp),%edi
call   1030 <a16@plt>
mov    %rax,-0x10(%rbp)
jmp    114a <a15+0x3a>
mov    -0x4(%rbp),%edi
call   1030 <a16@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a15>:
jmp    1030 <a16@plt>

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

LLVM IR (-O2):
define i8* @a15(i32 %0) {
%2 = tail call i8* @a16(i32 %0)
ret i8* %2
}
void ff_hevc_put_hevc_bi_w_qpel_h64_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_qpel_h64_12_sse4() {
ret void
}
int param_set_uint(const char *val, struct kernel_param *kp) { return 0; }


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

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

LLVM IR (-O0):
%struct.kernel_param = type opaque
define i32 @param_set_uint(i8* %0, %struct.kernel_param* %1) {
%3 = alloca i8*
%4 = alloca %struct.kernel_param*
store i8* %0, i8** %3
store %struct.kernel_param* %1, %struct.kernel_param** %4
ret i32 0
}

LLVM IR (-O2):
%struct.kernel_param = type opaque
define i32 @param_set_uint(i8* nocapture readnone %0, %struct.kernel_param* nocapture readnone %1) {
ret i32 0
}
char *guardit(char *ptr, int size) {
  unsigned long *lptr = (unsigned long *)ptr;
  lptr[0] = lptr[1] = size;
  ptr += (2 * sizeof(unsigned long));
  *(ptr + size) = 0x73;
  return ptr;
}


x86 assembly (clang, -O0):
<guardit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x73,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<guardit>:
movslq %esi,%rax
mov    %rax,0x8(%rdi)
mov    %rax,(%rdi)
movb   $0x73,0x10(%rdi,%rax,1)
lea    0x10(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @guardit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i64*
store i64* %7, i64** %5
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = load i64*, i64** %5
%11 = getelementptr inbounds i64, i64* %10, i64 1
store i64 %9, i64* %11
%12 = load i64*, i64** %5
%13 = getelementptr inbounds i64, i64* %12, i64 0
store i64 %9, i64* %13
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 16
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 115, i8* %19
%20 = load i8*, i8** %3
ret i8* %20
}

LLVM IR (-O2):
define i8* @guardit(i8* writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i64*
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = bitcast i8* %5 to i64*
store i64 %4, i64* %6
store i64 %4, i64* %3
%7 = getelementptr inbounds i8, i8* %0, i64 16
%8 = getelementptr inbounds i8, i8* %7, i64 %4
store i8 115, i8* %8
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ cgpostlude();
void genpostlude(void) { cgpostlude(); }


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

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

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

LLVM IR (-O2):
define void @genpostlude() {
%1 = tail call i32 (...) @cgpostlude()
ret void
}
unsigned int test_05(volatile unsigned short *x) { return x[5]; }


x86 assembly (clang, -O0):
<test_05>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xa(%rax),%ax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_05>:
movzwl 0xa(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @test_05(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = getelementptr inbounds i16, i16* %3, i64 5
%5 = load volatile i16, i16* %4
%6 = zext i16 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test_05(i16* %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 5
%3 = load volatile i16, i16* %2
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ PORTC_DriverIRQHandler();
__attribute__((weak)) void PORTC_IRQHandler(void) { PORTC_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @PORTC_IRQHandler() {
%1 = call i32 (...) @PORTC_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @PORTC_IRQHandler() {
%1 = tail call i32 (...) @PORTC_DriverIRQHandler()
ret void
}
int THAtomicCompareAndSwap(int volatile *a, int oldvalue, int newvalue) {
  if (*a == oldvalue) {
    *a = newvalue;
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<THAtomicCompareAndSwap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1132 <THAtomicCompareAndSwap+0x32>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1139 <THAtomicCompareAndSwap+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<THAtomicCompareAndSwap>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    %esi,%ecx
jne    110f <THAtomicCompareAndSwap+0xf>
mov    %edx,(%rdi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @THAtomicCompareAndSwap(i32* %0, i32 %1, i32 %2) {
%4 = load volatile i32, i32* %0
%5 = icmp eq i32 %4, %1
br i1 %5, label %6, label %7
6: ; preds = %3
store volatile i32 %2, i32* %0
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void get_version(char *version) { strcpy(version, "0.0.0"); }


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

x86 assembly (clang, -O2):
<get_version>:
lea    0xee9(%rip),%rsi
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"0.0.0\00"
define void @get_version(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"0.0.0\00"
define void @get_version(i8* %0) {
%2 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct gff3Ann {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gff3AnnErr(struct gff3Ann *, char *, char *);
void raiseInvalidEscape(struct gff3Ann *g3a, char *str) {
  gff3AnnErr(g3a, "invalid GFF escape sequence in string: %s", str);
}


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

x86 assembly (clang, -O2):
<raiseInvalidEscape>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <gff3AnnErr@plt>

LLVM IR (-O0):
%struct.gff3Ann = type { i32 }
@.str = [42 x i8] c"invalid GFF escape sequence in string: %s\00"
define void @raiseInvalidEscape(%struct.gff3Ann* %0, i8* %1) {
%3 = alloca %struct.gff3Ann*
%4 = alloca i8*
store %struct.gff3Ann* %0, %struct.gff3Ann** %3
store i8* %1, i8** %4
%5 = load %struct.gff3Ann*, %struct.gff3Ann** %3
%6 = load i8*, i8** %4
%7 = call i32 @gff3AnnErr(%struct.gff3Ann* %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
%struct.gff3Ann = type { i32 }
@.str = [42 x i8] c"invalid GFF escape sequence in string: %s\00"
define void @raiseInvalidEscape(%struct.gff3Ann* %0, i8* %1) {
%3 = tail call i32 @gff3AnnErr(%struct.gff3Ann* %0, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
cde() { printf("All "); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"All \00"
define i32 @cde() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void f() { int a = ""; }


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @f() {
%1 = alloca i32
store i32 ptrtoint ([1 x i8]* @.str to i32), i32* %1
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void my_init(void) { fputs("libeasy loaded\n", stdout); }


x86 assembly (clang, -O0):
<my_init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_init>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"libeasy loaded\0A\00"
@stdout = global i32 0
define void @my_init() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"libeasy loaded\0A\00"
@stdout = global i32 0
define void @my_init() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ execute_command(char **);
int /*<<< orphan*/ print_prompt();
int /*<<< orphan*/ read_command(char **);
int /*<<< orphan*/ signal_init(struct sigaction);
int main(int argc, char const *argv[]) {
  struct sigaction sa;
  signal_init(sa);
  char *command_arglist[50];
  do {
    print_prompt();
    read_command(command_arglist);
    execute_command(command_arglist);
  } while (1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <signal_init@plt>
mov    $0x0,%al
call   1040 <print_prompt@plt>
lea    -0x1b0(%rbp),%rdi
call   1030 <read_command@plt>
lea    -0x1b0(%rbp),%rdi
call   1060 <execute_command@plt>
mov    $0x1,%al
test   $0x1,%al
jne    1161 <main+0x21>
jmp    118f <main+0x4f>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
call   1050 <signal_init@plt>
mov    %rsp,%rbx
xor    %eax,%eax
call   1040 <print_prompt@plt>
mov    %rbx,%rdi
call   1030 <read_command@plt>
mov    %rbx,%rdi
call   1060 <execute_command@plt>
jmp    1150 <main+0x10>

LLVM IR (-O0):
%struct.sigaction = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sigaction
%7 = alloca [50 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %6, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @signal_init(i32 %9)
br label %11
11: ; preds = %17, %2
%12 = call i32 (...) @print_prompt()
%13 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 0
%14 = call i32 @read_command(i8** %13)
%15 = getelementptr inbounds [50 x i8*], [50 x i8*]* %7, i64 0, i64 0
%16 = call i32 @execute_command(i8** %15)
br label %17
17: ; preds = %11
br i1 true, label %11, label %18
18: ; preds = %17
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [50 x i8*]
%4 = tail call i32 @signal_init(i32 undef)
%5 = bitcast [50 x i8*]* %3 to i8*
%6 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 0
br label %7
7: ; preds = %7, %2
%8 = call i32 (...) @print_prompt()
%9 = call i32 @read_command(i8** %6)
%10 = call i32 @execute_command(i8** %6)
br label %7
}
int test_imm_62int64_lowword_reg(long long val) {
  return ((val) & (0x62 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_62int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 98
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int main() { return 23; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 23
}
int pragmad_comparison(const void *a, const void *b) {
  unsigned int *ia = (unsigned int *)a;
  unsigned int *ib = (unsigned int *)b;
  if (*ia < *ib)
    return 1;
  if (*ib < *ia)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<pragmad_comparison>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jae    113a <pragmad_comparison+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    115f <pragmad_comparison+0x5f>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jae    1158 <pragmad_comparison+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <pragmad_comparison+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pragmad_comparison>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
cmp    %eax,%ecx
sbb    %edx,%edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovae %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @pragmad_comparison(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp ult i32 %5, %6
%8 = icmp ult i32 %6, %5
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
bar() { echo("foo"); }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <echo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
define i32 @bar() {
%1 = alloca i32
%2 = call i32 @echo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define i32 @bar() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void USB_EndPoint6(uint32_t event) {}


x86 assembly (clang, -O0):
<USB_EndPoint6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @USB_EndPoint6(i32 %0) {
ret void
}
void process_directory(const char *path) {}


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

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

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

LLVM IR (-O2):
define void @process_directory(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arm_arith_cmn(int /*<<< orphan*/);
int /*<<< orphan*/ arm_data_regi_op();
void arm_cmn_regi() { arm_arith_cmn(arm_data_regi_op()); }


x86 assembly (clang, -O0):
<arm_cmn_regi>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <arm_data_regi_op@plt>
mov    %eax,%edi
call   1030 <arm_arith_cmn@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arm_cmn_regi>:
push   %rax
xor    %eax,%eax
call   1040 <arm_data_regi_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <arm_arith_cmn@plt>

LLVM IR (-O0):
define void @arm_cmn_regi() {
%1 = call i32 (...) @arm_data_regi_op()
%2 = call i32 @arm_arith_cmn(i32 %1)
ret void
}

LLVM IR (-O2):
define void @arm_cmn_regi() {
%1 = tail call i32 (...) @arm_data_regi_op()
%2 = tail call i32 @arm_arith_cmn(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clk_init();
int /*<<< orphan*/ cortexm_init();
int /*<<< orphan*/ periph_init();
void cpu_init(void) {
  cortexm_init();
  clk_init();
  periph_init();
}


x86 assembly (clang, -O0):
<cpu_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <cortexm_init@plt>
mov    $0x0,%al
call   1050 <clk_init@plt>
mov    $0x0,%al
call   1030 <periph_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_init>:
push   %rax
xor    %eax,%eax
call   1040 <cortexm_init@plt>
xor    %eax,%eax
call   1050 <clk_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <periph_init@plt>

LLVM IR (-O0):
define void @cpu_init() {
%1 = call i32 (...) @cortexm_init()
%2 = call i32 (...) @clk_init()
%3 = call i32 (...) @periph_init()
ret void
}

LLVM IR (-O2):
define void @cpu_init() {
%1 = tail call i32 (...) @cortexm_init()
%2 = tail call i32 (...) @clk_init()
%3 = tail call i32 (...) @periph_init()
ret void
}
void av_strncasecmp() {}


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

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

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

LLVM IR (-O2):
define void @av_strncasecmp() {
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compare_args(void *a1, void *a2) {
  char **s1 = (char **)a1;
  char **s2 = (char **)a2;
  return strcmp(*s1, *s2);
}


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

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

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

LLVM IR (-O2):
define i32 @compare_args(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
int op_sub(int a, int b) { return (a - b); }


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

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

LLVM IR (-O0):
define i32 @op_sub(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @op_sub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int ENOMEM;
int /*<<< orphan*/ log_error_errno(int /*<<< orphan*/, char *);
int log_oom(void) {
  log_error_errno(0, "Out of memory");
  return -ENOMEM;
}


x86 assembly (clang, -O0):
<log_oom>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
call   1030 <log_error_errno@plt>
xor    %eax,%eax
mov    0x2eb5(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_oom>:
push   %rbx
lea    0xee8(%rip),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <log_error_errno@plt>
mov    0x2eb8(%rip),%rax
sub    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
@ENOMEM = global i32 0
define i32 @log_oom() {
%1 = call i32 @log_error_errno(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @ENOMEM
%3 = sub nsw i32 0, %2
ret i32 %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
@ENOMEM = global i32 0
define i32 @log_oom() {
%1 = tail call i32 @log_error_errno(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @ENOMEM
%3 = sub nsw i32 0, %2
ret i32 %3
}
int BoostLimit(int boost, int limit) {
  if (boost > limit) {
    boost = limit;
  }
  if (boost < -limit) {
    boost = -limit;
  }
  return (boost);
}


x86 assembly (clang, -O0):
<BoostLimit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    111c <BoostLimit+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1134 <BoostLimit+0x34>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BoostLimit>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %esi,%edi
neg    %eax
cmp    %eax,%edi
cmovge %edi,%eax
ret

LLVM IR (-O0):
define i32 @BoostLimit(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 sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sub nsw i32 0, %12
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %4
%17 = sub nsw i32 0, %16
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @BoostLimit(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
%5 = sub nsw i32 0, %1
%6 = icmp slt i32 %4, %5
%7 = select i1 %6, i32 %5, i32 %4
ret i32 %7
}
/* Type definitions */
struct tgdb_list {
  int dummy;
};
struct annotate_two {
  int dummy;
};

/* Variables and functions */
int handle_unwanted_fields(struct annotate_two *a2, const char *buf, size_t n,
                           struct tgdb_list *list) {
  return 0;
}


x86 assembly (clang, -O0):
<handle_unwanted_fields>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.annotate_two = type { i32 }
%struct.tgdb_list = type { i32 }
define i32 @handle_unwanted_fields(%struct.annotate_two* %0, i8* %1, i64 %2, %struct.tgdb_list* %3) {
%5 = alloca %struct.annotate_two*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca %struct.tgdb_list*
store %struct.annotate_two* %0, %struct.annotate_two** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store %struct.tgdb_list* %3, %struct.tgdb_list** %8
ret i32 0
}

LLVM IR (-O2):
%struct.annotate_two = type { i32 }
%struct.tgdb_list = type { i32 }
define i32 @handle_unwanted_fields(%struct.annotate_two* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, %struct.tgdb_list* nocapture readnone %3) {
ret i32 0
}
void fa55(void) {
P0A:
  goto P0A;
  ({
    P01A:
      goto P01A;
      ({
        P012A:
          goto P012A;
          0;
      });
    a:
      goto a;
    P01B:
      goto P01B;
      ({
        P013A:
          goto P013A;
          0;
      });
    P01C:
      goto P01C;
      0;
  });
P0B:
  goto P0B;
  ({
    P02A:
      goto P02A;
      ({
        P024A:
          goto P024A;
          0;
      });
    P02B:
      goto P02B;
      ({
        P025A:
          goto P025A;
          0;
      });
    P02C:
      goto P02C;
      0;
  });
P0C:
  goto P0C;
  0;
P0D:
  goto P0D;
}


x86 assembly (clang, -O0):
<fa55>:
push   %rbp
mov    %rsp,%rbp
jmp    1104 <fa55+0x4>

x86 assembly (clang, -O2):
<fa55>:
jmp    1100 <fa55>

LLVM IR (-O0):
define void @fa55() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
br label %7
7: ; preds = %7, %0
br label %7
8: ; No predecessors!
br label %9
9: ; preds = %9, %8
br label %9
10: ; No predecessors!
br label %11
11: ; preds = %11, %10
br label %11
12: ; preds = %12
br label %12
13: ; preds = %13
br label %13
14: ; No predecessors!
br label %15
15: ; preds = %15, %14
br label %15
16: ; preds = %16
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
br label %19
19: ; preds = %19, %18
br label %19
20: ; No predecessors!
br label %21
21: ; preds = %21, %20
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
br label %24
24: ; preds = %24, %23
br label %24
25: ; preds = %25
br label %25
26: ; preds = %26
br label %26
27: ; preds = %27
br label %27
}

LLVM IR (-O2):
define void @fa55() {
br label %1
1: ; preds = %1, %0
br label %1
}
int isinitiator(int c) {
  switch (c) {
  case ',':
  case ';':
  case '{':
  case '}':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isinitiator>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2c,%eax
je     114e <isinitiator+0x4e>
jmp    111b <isinitiator+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x3b,%eax
je     114e <isinitiator+0x4e>
jmp    112c <isinitiator+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x7b,%eax
je     114e <isinitiator+0x4e>
jmp    113d <isinitiator+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x7d,%eax
jne    115a <isinitiator+0x5a>
jmp    114e <isinitiator+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1161 <isinitiator+0x61>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinitiator>:
mov    $0x1,%eax
cmp    $0x7a,%edi
jg     1115 <isinitiator+0x15>
cmp    $0x2c,%edi
je     1114 <isinitiator+0x14>
cmp    $0x3b,%edi
jne    111f <isinitiator+0x1f>
ret
cmp    $0x7b,%edi
je     1114 <isinitiator+0x14>
cmp    $0x7d,%edi
je     1114 <isinitiator+0x14>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isinitiator(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 44, label %5
i32 59, label %5
i32 123, label %5
i32 125, label %5
]
5: ; preds = %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @isinitiator(i32 %0) {
switch i32 %0, label %2 [
i32 44, label %3
i32 59, label %3
i32 123, label %3
i32 125, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("EOF = %i\n", EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"EOF = %i\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EOF
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
scalar_t__ islower(int);
scalar_t__ isupper(int);
int isalpha(int ch) {
  if (isupper(ch) || islower(ch))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <isupper@plt>
cmp    $0x0,%rax
jne    114f <isalpha+0x2f>
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     115b <isalpha+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1162 <isalpha+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha>:
push   %rbx
mov    %edi,%ebx
call   1040 <isupper@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <isalpha+0x17>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <islower@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @isalpha(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @islower(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ consoleCmdSource(char *);
int /*<<< orphan*/ consolePrintErr(char *);
char *scriptCatchException();
void consoleExecFile(char *path) {
  consoleCmdSource(path);
  char *err = scriptCatchException();
  if (err)
    consolePrintErr(err);
}


x86 assembly (clang, -O0):
<consoleExecFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <consoleCmdSource@plt>
mov    $0x0,%al
call   1040 <scriptCatchException@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1164 <consoleExecFile+0x34>
mov    -0x10(%rbp),%rdi
call   1030 <consolePrintErr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consoleExecFile>:
push   %rax
call   1050 <consoleCmdSource@plt>
xor    %eax,%eax
call   1040 <scriptCatchException@plt>
test   %rax,%rax
je     114b <consoleExecFile+0x1b>
mov    %rax,%rdi
pop    %rax
jmp    1030 <consolePrintErr@plt>
pop    %rax
ret

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

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