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

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
scalar_t__ fgetc(int /*<<< orphan*/ *);
void calculfrequence(FILE *f, unsigned long int t[]) {
  char a;
  while (!feof(f)) {
    t[(unsigned char)fgetc(f)]++;
  }
}


x86 assembly (clang, -O0):
<calculfrequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114e <calculfrequence+0x2e>
jmp    117a <calculfrequence+0x5a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movzbl %cl,%ecx
mov    (%rax,%rcx,8),%rdx
add    $0x1,%rdx
mov    %rdx,(%rax,%rcx,8)
jmp    1130 <calculfrequence+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculfrequence>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
call   1040 <feof@plt>
test   %eax,%eax
jne    114e <calculfrequence+0x2e>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
movzbl %al,%eax
addq   $0x1,(%r14,%rax,8)
mov    %rbx,%rdi
jmp    1130 <calculfrequence+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @calculfrequence(i32* %0, i64* %1) {
%3 = alloca i32*
%4 = alloca i64*
%5 = alloca i8
store i32* %0, i32** %3
store i64* %1, i64** %4
br label %6
6: ; preds = %11, %2
%7 = load i32*, i32** %3
%8 = call i32 @feof(i32* %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %20
11: ; preds = %6
%12 = load i64*, i64** %4
%13 = load i32*, i32** %3
%14 = call i64 @fgetc(i32* %13)
%15 = trunc i64 %14 to i8
%16 = zext i8 %15 to i64
%17 = getelementptr inbounds i64, i64* %12, i64 %16
%18 = load i64, i64* %17
%19 = add i64 %18, 1
store i64 %19, i64* %17
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @calculfrequence(i32* nocapture %0, i64* nocapture %1) {
%3 = tail call i32 @feof(i32* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %2, %5
%6 = tail call i64 @fgetc(i32* %0)
%7 = and i64 %6, 255
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = add i64 %9, 1
store i64 %10, i64* %8
%11 = tail call i32 @feof(i32* %0)
%12 = icmp eq i32 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(size_t const);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          size_t const);
uint8_t *clone_u8ivector(const uint8_t *v, const size_t n) {
  uint8_t *clone = malloc(n * sizeof(uint8_t));
  memcpy(clone, v, n * sizeof(uint8_t));
  return clone;
}


x86 assembly (clang, -O0):
<clone_u8ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
shl    $0x2,%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clone_u8ivector>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0x0(,%rsi,4),%r15
mov    %r15,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @clone_u8ivector(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32*
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = mul i64 %6, 4
%8 = call i32* @malloc(i64 %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = load i32*, i32** %3
%11 = load i64, i64* %4
%12 = mul i64 %11, 4
%13 = call i32 @memcpy(i32* %9, i32* %10, i64 %12)
%14 = load i32*, i32** %5
ret i32* %14
}

LLVM IR (-O2):
define i32* @clone_u8ivector(i32* %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = tail call i32* @malloc(i64 %3)
%5 = tail call i32 @memcpy(i32* %4, i32* %0, i64 %3)
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ executeSQL(char *, int);
int /*<<< orphan*/ openDatabase(char *);
void openDB(char *dbname) {
  int ret;
  openDatabase(dbname);
  executeSQL("CREATE TABLE IF NOT EXISTS users                  "
             "(username[char(40)][NOT NULL], password[char(80)][NOT NULL],     "
             "             enabled[int(1)][NOT NULL], PRIMARY KEY(username),   "
             "               UNIQUE(username))",
             1);
}


x86 assembly (clang, -O0):
<openDB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <openDatabase@plt>
lea    0xec4(%rip),%rdi
mov    $0x1,%esi
call   1040 <executeSQL@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openDB>:
push   %rax
call   1030 <openDatabase@plt>
lea    0xed3(%rip),%rdi
mov    $0x1,%esi
pop    %rax
jmp    1040 <executeSQL@plt>

LLVM IR (-O0):
@.str = [213 x i8] c"CREATE TABLE IF NOT EXISTS users (username[char(40)][NOT NULL], password[char(80)][NOT NULL], enabled[int(1)][NOT NULL], PRIMARY KEY(username), UNIQUE(username))\00"
define void @openDB(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @openDatabase(i8* %4)
%6 = call i32 @executeSQL(i8* getelementptr inbounds ([213 x i8], [213 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [213 x i8] c"CREATE TABLE IF NOT EXISTS users (username[char(40)][NOT NULL], password[char(80)][NOT NULL], enabled[int(1)][NOT NULL], PRIMARY KEY(username), UNIQUE(username))\00"
define void @openDB(i8* %0) {
%2 = tail call i32 @openDatabase(i8* %0)
%3 = tail call i32 @executeSQL(i8* getelementptr inbounds ([213 x i8], [213 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
void rop3_195_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = T ^ S;
  stk1 = ~stk1;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_195_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_195_0_1>:
mov    %esi,%eax
xor    %dl,%al
not    %al
not    %sil
and    %dl,%sil
and    (%rdi),%sil
or     %al,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_195_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = xor i32 %9, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = zext i8 %14 to i32
%16 = xor i32 %15, -1
%17 = trunc i32 %16 to i8
store i8 %17, i8* %7
%18 = load i8, i8* %7
%19 = zext i8 %18 to i32
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = and i32 %19, %21
%23 = load i8, i8* %7
%24 = zext i8 %23 to i32
%25 = load i8, i8* %6
%26 = zext i8 %25 to i32
%27 = xor i32 %26, -1
%28 = and i32 %24, %27
%29 = or i32 %22, %28
%30 = load i8, i8* %6
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = xor i32 %33, -1
%35 = and i32 %31, %34
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = and i32 %35, %38
%40 = or i32 %29, %39
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %4
store i8 %41, i8* %42
ret void
}

LLVM IR (-O2):
define void @rop3_195_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, %2
%5 = xor i8 %4, -1
%6 = xor i8 %1, -1
%7 = and i8 %6, %2
%8 = load i8, i8* %0
%9 = and i8 %7, %8
%10 = or i8 %9, %5
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_help(void) { fprintf(stderr, "usage: wtfc -[undslwre] -[fNc]\n"); }


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"usage: wtfc -[undslwre] -[fNc]\0A\00"
define void @print_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"usage: wtfc -[undslwre] -[fNc]\0A\00"
define void @print_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}
void OS_EndProgram(void) {}


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

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

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

LLVM IR (-O2):
define void @OS_EndProgram() {
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t geofence_slow_tlm_altitude(char *alt, int alt_len) {
  if (alt_len <= 3)
    return 1;
  if (alt_len >= 5)
    return 0;
  if (alt[0] >= '4')
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<geofence_slow_tlm_altitude>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jg     1121 <geofence_slow_tlm_altitude+0x21>
movl   $0x1,-0x4(%rbp)
jmp    115a <geofence_slow_tlm_altitude+0x5a>
cmpl   $0x5,-0x14(%rbp)
jl     1137 <geofence_slow_tlm_altitude+0x37>
movl   $0x0,-0x4(%rbp)
jmp    115a <geofence_slow_tlm_altitude+0x5a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x34,%eax
jl     1153 <geofence_slow_tlm_altitude+0x53>
movl   $0x0,-0x4(%rbp)
jmp    115a <geofence_slow_tlm_altitude+0x5a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<geofence_slow_tlm_altitude>:
mov    $0x1,%eax
cmp    $0x4,%esi
jl     1119 <geofence_slow_tlm_altitude+0x19>
xor    %eax,%eax
cmp    $0x4,%esi
jne    1119 <geofence_slow_tlm_altitude+0x19>
xor    %eax,%eax
cmpb   $0x34,(%rdi)
setl   %al
ret

LLVM IR (-O0):
define i32 @geofence_slow_tlm_altitude(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 i32, i32* %5
%7 = icmp sle i32 %6, 3
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %3
br label %21
9: ; preds = %2
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 5
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 0, i32* %3
br label %21
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 52
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 0, i32* %3
br label %21
20: ; preds = %13
store i32 1, i32* %3
br label %21
21: ; preds = %20, %19, %12, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @geofence_slow_tlm_altitude(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 4
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp eq i32 %1, 4
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = load i8, i8* %0
%8 = icmp slt i8 %7, 52
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %4, %2
%11 = phi i32 [ 1, %2 ], [ 0, %4 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void doit(int sockfd) { printf("accept socket fd: %d.\n", sockfd); }


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

x86 assembly (clang, -O2):
<doit>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"accept socket fd: %d.\0A\00"
define void @doit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"accept socket fd: %d.\0A\00"
define void @doit(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void timeR_startup_done(void) {}


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

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

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

LLVM IR (-O2):
define void @timeR_startup_done() {
ret void
}
adr0imm1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*((unsigned short *)10000000)) <= 33)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adr0imm1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movzwl (%rax),%eax
cmp    $0x21,%eax
jg     113c <adr0imm1+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <adr0imm1+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0imm1>:
xor    %eax,%eax
cmpw   $0x22,0x989680
setb   %al
ret

LLVM IR (-O0):
define i32 @adr0imm1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16, i16* inttoptr (i64 10000000 to i16*)
%17 = zext i16 %16 to i32
%18 = icmp sle i32 %17, 33
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 1, i32* %7
br label %21
20: ; preds = %6
store i32 0, i32* %7
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @adr0imm1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
%7 = load i16, i16* inttoptr (i64 10000000 to i16*)
%8 = icmp ult i16 %7, 34
%9 = zext i1 %8 to i32
ret i32 %9
}
void _start() { asm("int $0x80" ::"a"(1), "b"(0)); }


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    $0x1,%eax
xor    %ebx,%ebx
int    $0x80
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start>:
push   %rbx
mov    $0x1,%eax
xor    %ebx,%ebx
int    $0x80
pop    %rbx
ret

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

LLVM IR (-O2):
define void @_start() {
tail call void asm sideeffect "int $$0x80", "{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[0]) {
  fprintf(stderr,
          "%s: this program built on the platform without THREAD LOCAL STORAGE "
          "(TLS) support.\n",
          argv[0]);
  exit(1);
}


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    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [84 x i8] c"%s: this program built on the platform without THREAD LOCAL STORAGE (TLS) support.\0A\00"
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* @stderr
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [84 x i8] c"%s: this program built on the platform without THREAD LOCAL STORAGE (TLS) support.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(char *);
char *malloc(int);
int /*<<< orphan*/ strcpyn(char *, char const *, int);
char *read_fixed_size_string(const char *str, int len) {
  char *news;
  news = malloc(len + 1);
  if (!news)
    fatal_error("Cannot allocate");
  strcpyn(news, str, len);
  news[len] = '\0';
  return news;
}


x86 assembly (clang, -O0):
<read_fixed_size_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1165 <read_fixed_size_string+0x35>
lea    0xea0(%rip),%rdi
call   1030 <fatal_error@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <strcpyn@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_fixed_size_string>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1158 <read_fixed_size_string+0x28>
lea    0xead(%rip),%rdi
call   1030 <fatal_error@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <strcpyn@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"Cannot allocate\00"
define i8* @read_fixed_size_string(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @fatal_error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = tail call i32 @strcpyn(i8* %4, i8* %0, i32 %1)
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds i8, i8* %4, i64 %10
store i8 0, i8* %11
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("\033[31;5mI love it"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"\1B[31;5mI love it\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\1B[31;5mI love it\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int set_thread_prio(int /*<<< orphan*/, int);
int set_prio(int prio) { return set_thread_prio(0, prio); }


x86 assembly (clang, -O0):
<set_prio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <set_thread_prio@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_prio>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <set_thread_prio@plt>

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

LLVM IR (-O2):
define i32 @set_prio(i32 %0) {
%2 = tail call i32 @set_thread_prio(i32 0, i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void newline_printer() { printf("\n"); }


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

x86 assembly (clang, -O2):
<newline_printer>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @newline_printer() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
int main(int argc, const char *argv[]) {
  printf("%d, %d\n", ({
           __typeof__(1) _a = (1);
           __typeof__(2) _b = (2);
           _a > _b ? _a : _b;
         }),
         ({
           __auto_type _a = (3);
           __auto_type _b = (4);
           _a > _b ? _a : _b;
         }));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    114b <main+0x3b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1151 <main+0x41>
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x3,-0x20(%rbp)
movl   $0x4,-0x24(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    1182 <main+0x72>
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    1188 <main+0x78>
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edx
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 2, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = load i32, i32* %6
br label %19
17: ; preds = %2
%18 = load i32, i32* %7
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %18, %17 ]
store i32 %20, i32* %8
%21 = load i32, i32* %8
store i32 3, i32* %9
store i32 4, i32* %10
%22 = load i32, i32* %9
%23 = load i32, i32* %10
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = load i32, i32* %9
br label %29
27: ; preds = %19
%28 = load i32, i32* %10
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
store i32 %30, i32* %11
%31 = load i32, i32* %11
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2, i32 4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void errExit(const char *errMsg) {
  int oldErrno = errno;
  fprintf(stderr, "Quitting on error: %s\n", errMsg);
  fprintf(stderr, "Errno was %i\n", oldErrno);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<errExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<errExit>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rdx
mov    0x2eaa(%rip),%rax
mov    (%rax),%ebx
mov    0x2ea9(%rip),%r14
mov    (%r14),%edi
lea    0xebf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xec5(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"Quitting on error: %s\0A\00"
@.str.1 = [14 x i8] c"Errno was %i\0A\00"
@EXIT_FAILURE = global i32 0
define void @errExit(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @errno
store i32 %4, i32* %3
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = load i32, i32* %3
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [23 x i8] c"Quitting on error: %s\0A\00"
@.str.1 = [14 x i8] c"Errno was %i\0A\00"
@EXIT_FAILURE = global i32 0
define void @errExit(i8* %0) {
%2 = load i32, i32* @errno
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ func2();
int /*<<< orphan*/ sleep(int);
void func1() {
  sleep(20);
  func2();
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x14,%edi
call   1040 <sleep@plt>
mov    $0x0,%al
call   1030 <func2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
push   %rax
mov    $0x14,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <func2@plt>

LLVM IR (-O0):
define void @func1() {
%1 = call i32 @sleep(i32 20)
%2 = call i32 (...) @func2()
ret void
}

LLVM IR (-O2):
define void @func1() {
%1 = tail call i32 @sleep(i32 20)
%2 = tail call i32 (...) @func2()
ret void
}
void g_io_channel_new_file() {}


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

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

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

LLVM IR (-O2):
define void @g_io_channel_new_file() {
ret void
}
/* Variables and functions */
int write_blob();
int main(void) {
  int err;
  err = write_blob();
  if (err < 0)
    return err;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <write_blob@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    113e <main+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1145 <main+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <write_blob@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
and    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @write_blob()
%2 = icmp slt i32 %1, 0
%3 = select i1 %2, i32 %1, i32 0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t now;
  time(&now);
  fputs(ctime(&now), stdout);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <ctime@plt>
mov    0x2e8f(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <fputs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* %2)
%4 = call i32 @ctime(i32* %2)
%5 = load i32, i32* @stdout
%6 = call i32 @fputs(i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call i32 @ctime(i32* %1)
%5 = load i32, i32* @stdout
%6 = call i32 @fputs(i32 %4, i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ remainder(double, double);
int /*<<< orphan*/ remainderf(float, float);
int /*<<< orphan*/ remainderl(long double, long double);
void uninitvar_remainder(void) {
  float f1, f2;
  (void)remainderf(f1, f2);
  double d1, d2;
  (void)remainder(d1, d2);
  long double ld1, ld2;
  (void)remainderl(ld1, ld2);
}


x86 assembly (clang, -O0):
<uninitvar_remainder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1050 <remainderf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <remainder@plt>
fldt   -0x30(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1040 <remainderl@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_remainder>:
sub    $0x28,%rsp
call   1050 <remainderf@plt>
call   1030 <remainder@plt>
call   1040 <remainderl@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @uninitvar_remainder() {
%1 = alloca float
%2 = alloca float
%3 = alloca double
%4 = alloca double
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = load float, float* %1
%8 = load float, float* %2
%9 = call i32 @remainderf(float %7, float %8)
%10 = load double, double* %3
%11 = load double, double* %4
%12 = call i32 @remainder(double %10, double %11)
%13 = load x86_fp80, x86_fp80* %5
%14 = load x86_fp80, x86_fp80* %6
%15 = call i32 @remainderl(x86_fp80 %13, x86_fp80 %14)
ret void
}

LLVM IR (-O2):
define void @uninitvar_remainder() {
%1 = tail call i32 @remainderf(float undef, float undef)
%2 = tail call i32 @remainder(double undef, double undef)
%3 = tail call i32 @remainderl(x86_fp80 undef, x86_fp80 undef)
ret void
}
/* Variables and functions */
int max_sum(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a[7] = {-2, 5, 3, -6, 4, -8, 6};
  printf("answer: %d\n", max_sum(a, 7));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1030 <max_sum@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <max_sum@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [7 x i32] [i32 -2, i32 5, i32 3, i32 -6, i32 4, i32 -8, i32 6]
@.str = [12 x i8] c"answer: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
store i32 0, i32* %1
%3 = bitcast [7 x i32]* %2 to i8*
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%5 = call i32 @max_sum(i32* %4, i32 7)
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [7 x i32] [i32 -2, i32 5, i32 3, i32 -6, i32 4, i32 -8, i32 6]
@.str = [12 x i8] c"answer: %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @max_sum(i32* %3, i32 7)
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
int hexascii(register int data) {
  if (data > 47 && data < 58)
    return (data - 48);
  if (data > 64 && data < 71)
    return (data - 55);
  if (data > 96 && data < 103)
    return (data - 87);
  return -1;
}


x86 assembly (clang, -O0):
<hexascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2f,-0x8(%rbp)
jle    1129 <hexascii+0x29>
cmpl   $0x3a,-0x8(%rbp)
jge    1129 <hexascii+0x29>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hexascii+0x74>
cmpl   $0x40,-0x8(%rbp)
jle    114b <hexascii+0x4b>
cmpl   $0x47,-0x8(%rbp)
jge    114b <hexascii+0x4b>
mov    -0x8(%rbp),%eax
sub    $0x37,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hexascii+0x74>
cmpl   $0x60,-0x8(%rbp)
jle    116d <hexascii+0x6d>
cmpl   $0x67,-0x8(%rbp)
jge    116d <hexascii+0x6d>
mov    -0x8(%rbp),%eax
sub    $0x57,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <hexascii+0x74>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexascii>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
jb     1127 <hexascii+0x27>
lea    -0x41(%rdi),%eax
cmp    $0x5,%eax
ja     1116 <hexascii+0x16>
add    $0xffffffc9,%edi
mov    %edi,%eax
ret
lea    -0x61(%rdi),%eax
add    $0xffffffa9,%edi
cmp    $0x6,%eax
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @hexascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 47
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 58
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %2
br label %31
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 64
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 71
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 55
store i32 %20, i32* %2
br label %31
21: ; preds = %15, %12
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 96
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 103
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, 87
store i32 %29, i32* %2
br label %31
30: ; preds = %24, %21
store i32 -1, i32* %2
br label %31
31: ; preds = %30, %27, %18, %9
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @hexascii(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add i32 %0, -65
%6 = icmp ult i32 %5, 6
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i32 %0, -55
br label %14
9: ; preds = %4
%10 = add i32 %0, -97
%11 = icmp ult i32 %10, 6
%12 = add nsw i32 %0, -87
%13 = select i1 %11, i32 %12, i32 -1
br label %14
14: ; preds = %1, %9, %7
%15 = phi i32 [ %8, %7 ], [ %13, %9 ], [ %2, %1 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ quit(int);
void noodstop() { quit(-3); }


x86 assembly (clang, -O0):
<noodstop>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffd,%edi
call   1030 <quit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<noodstop>:
mov    $0xfffffffd,%edi
jmp    1030 <quit@plt>

LLVM IR (-O0):
define void @noodstop() {
%1 = call i32 @quit(i32 -3)
ret void
}

LLVM IR (-O2):
define void @noodstop() {
%1 = tail call i32 @quit(i32 -3)
ret void
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
char *pd9p_enc1(char *buf, uint8_t val) {
  buf[0] = val;
  return buf + 1;
}


x86 assembly (clang, -O0):
<pd9p_enc1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd9p_enc1>:
mov    %sil,(%rdi)
lea    0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @pd9p_enc1(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 %5, i8* %7
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
ret i8* %9
}

LLVM IR (-O2):
define i8* @pd9p_enc1(i8* writeonly %0, i8 signext %1) {
store i8 %1, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %3
}
int main(int argc, char *argv[]) {
  int i = 1;
  int j;
  while (i < 10) {
    j = i;
    ++i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1137 <main+0x37>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  char buf[10] = {0};
  sprintf(buf, "%02x", -3);
  printf("%s\r\n", buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    -0xe(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0xfffffffd,%edx
call   1050 <sprintf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xec5(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xfffffffd,%edx
call   1040 <sprintf@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [5 x i8] c"%s\0D\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -3)
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ reqbuf;

/* Variables and functions */
int ph_rpc(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int phTransferCall(int cid, int tcid) {
  char reqbuf[1000];
  snprintf(reqbuf, sizeof(reqbuf), "TXCALL CID=%d CIDT=%d", cid, tcid);
  return ph_rpc(reqbuf);
}


x86 assembly (clang, -O0):
<phTransferCall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    $0x3e8,%esi
lea    0xeb5(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x3f0(%rbp),%rdi
call   1040 <ph_rpc@plt>
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phTransferCall>:
push   %rbx
sub    $0x3f0,%rsp
mov    %esi,%r8d
mov    %edi,%ecx
lea    0xecc(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <ph_rpc@plt>
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"TXCALL CID=%d CIDT=%d\00"
define i32 @phTransferCall(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @snprintf(i8* %6, i32 1000, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%11 = call i32 @ph_rpc(i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [22 x i8] c"TXCALL CID=%d CIDT=%d\00"
define i32 @phTransferCall(i32 %0, i32 %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 1000, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%6 = call i32 @ph_rpc(i8* %4)
ret i32 %6
}
int fun810() { return 810; }


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

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

LLVM IR (-O0):
define i32 @fun810() {
ret i32 810
}

LLVM IR (-O2):
define i32 @fun810() {
ret i32 810
}
/* Type definitions */
struct sockaddr_storage {
  int /*<<< orphan*/ ss_family;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                             size_t);
void get_address_str(struct sockaddr_storage *address, char *address_str,
                     size_t str_size) {
  inet_ntop(address->ss_family, get_in_addr((struct sockaddr *)address),
            address_str, str_size);
}


x86 assembly (clang, -O0):
<get_address_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_in_addr@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <inet_ntop@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_address_str>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    (%rdi),%ebp
call   1040 <get_in_addr@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <inet_ntop@plt>

LLVM IR (-O0):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
define void @get_address_str(%struct.sockaddr_storage* %0, i8* %1, i64 %2) {
%4 = alloca %struct.sockaddr_storage*
%5 = alloca i8*
%6 = alloca i64
store %struct.sockaddr_storage* %0, %struct.sockaddr_storage** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %4
%8 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load %struct.sockaddr_storage*, %struct.sockaddr_storage** %4
%11 = bitcast %struct.sockaddr_storage* %10 to %struct.sockaddr*
%12 = call i32 @get_in_addr(%struct.sockaddr* %11)
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = call i32 @inet_ntop(i32 %9, i32 %12, i8* %13, i64 %14)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
define void @get_address_str(%struct.sockaddr_storage* %0, i8* %1, i64 %2) {
%4 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = bitcast %struct.sockaddr_storage* %0 to %struct.sockaddr*
%7 = tail call i32 @get_in_addr(%struct.sockaddr* %6)
%8 = tail call i32 @inet_ntop(i32 %5, i32 %7, i8* %1, i64 %2)
ret void
}