xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ unlink(char *);
void pidfile_delete(char *pidfile) {
  if (pidfile)
    unlink(pidfile);
}


x86 assembly (clang, -O0):
<pidfile_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <pidfile_delete+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pidfile_delete>:
test   %rdi,%rdi
je     111a <pidfile_delete+0xa>
jmp    1030 <unlink@plt>
ret

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

LLVM IR (-O2):
define void @pidfile_delete(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @unlink(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int ieee80211_sta_init(struct wpa_supplicant *wpa_s) { return 0; }


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

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

LLVM IR (-O0):
%struct.wpa_supplicant = type opaque
define i32 @ieee80211_sta_init(%struct.wpa_supplicant* %0) {
%2 = alloca %struct.wpa_supplicant*
store %struct.wpa_supplicant* %0, %struct.wpa_supplicant** %2
ret i32 0
}

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define i32 @ieee80211_sta_init(%struct.wpa_supplicant* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_algorithms(char *);
int /*<<< orphan*/ test_porcelain(char *);
int main() {
  char *puzzle_key = "test/resources/almost_complete.puzzle";
  char *zeroes = "test/resources/only_zeroes.puzzle";
  while (1) {
    test_porcelain(zeroes);
    test_algorithms(zeroes);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xee5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <test_porcelain@plt>
mov    -0x18(%rbp),%rdi
call   1040 <test_algorithms@plt>
jmp    1145 <main+0x25>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <test_porcelain@plt>
mov    %rbx,%rdi
call   1040 <test_algorithms@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
@.str = [38 x i8] c"test/resources/almost_complete.puzzle\00"
@.str.1 = [34 x i8] c"test/resources/only_zeroes.puzzle\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %0, %4
%5 = load i8*, i8** %3
%6 = call i32 @test_porcelain(i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @test_algorithms(i8* %7)
br label %4
}

LLVM IR (-O2):
@.str.1 = [34 x i8] c"test/resources/only_zeroes.puzzle\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @test_porcelain(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @test_algorithms(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %1
}
unsigned long _ntl_GetPID() { return 0; }


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

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

LLVM IR (-O0):
define i64 @_ntl_GetPID() {
ret i64 0
}

LLVM IR (-O2):
define i64 @_ntl_GetPID() {
ret i64 0
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int linebuffer_write(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int linebuffer_puts(BIO *b, const char *str) {
  return (linebuffer_write(b, str, strlen(str)));
}


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

x86 assembly (clang, -O2):
<linebuffer_puts>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <linebuffer_write@plt>

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

LLVM IR (-O2):
define i32 @linebuffer_puts(i32* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @linebuffer_write(i32* %0, i8* %1, i32 %3)
ret i32 %4
}
unsigned plus_1_mod_3(const unsigned x) { return ((x | x >> 1) + 1) & 3u; }


x86 assembly (clang, -O0):
<plus_1_mod_3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
or     %ecx,%eax
add    $0x1,%eax
and    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<plus_1_mod_3>:
mov    %edi,%eax
shr    %eax
or     %edi,%eax
add    $0x1,%eax
and    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @plus_1_mod_3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = lshr i32 %4, 1
%6 = or i32 %3, %5
%7 = add i32 %6, 1
%8 = and i32 %7, 3
ret i32 %8
}

LLVM IR (-O2):
define i32 @plus_1_mod_3(i32 %0) {
%2 = lshr i32 %0, 1
%3 = or i32 %2, %0
%4 = add i32 %3, 1
%5 = and i32 %4, 3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ parse(long, int *, int *, int *);
int get_pmonth(long day) {
  int y, m, d;
  parse(day, &y, &m, &d);
  return m;
}


x86 assembly (clang, -O0):
<get_pmonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1030 <parse@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pmonth>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <parse@plt>
mov    0xc(%rsp),%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @get_pmonth(i64 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = call i32 @parse(i64 %0, i32* %2, i32* %3, i32* %4)
%9 = load i32, i32* %3
ret i32 %9
}
int test_imm_A8int16_reg(short val) {
  return ((val) & (-0xA8 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A8int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff58,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A8int16_reg>:
test   $0xff58,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A8int16_reg(i16 signext %0) {
%2 = and i16 %0, -168
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ idle();
int /*<<< orphan*/ kputs(char const *);
void panic(const char *s) {
  kputs("panic: ");
  kputs(s);
  kputs((const char *)0x0A);
  idle();
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <kputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <kputs@plt>
mov    $0xa,%edi
call   1040 <kputs@plt>
mov    $0x0,%al
call   1030 <idle@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<panic>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <kputs@plt>
mov    %rbx,%rdi
call   1040 <kputs@plt>
mov    $0xa,%edi
call   1040 <kputs@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <idle@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"panic: \00"
define void @panic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @kputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @kputs(i8* %4)
%6 = call i32 @kputs(i8* inttoptr (i64 10 to i8*))
%7 = call i32 (...) @idle()
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"panic: \00"
define void @panic(i8* %0) {
%2 = tail call i32 @kputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @kputs(i8* %0)
%4 = tail call i32 @kputs(i8* inttoptr (i64 10 to i8*))
%5 = tail call i32 (...) @idle()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void banner(void) { puts("\nsmurf.c v4.0 by TFreak\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"\0Asmurf.c v4.0 by TFreak\0A\00"
define void @banner() {
%1 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0Asmurf.c v4.0 by TFreak\0A\00"
define void @banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void comeco_fim(void (*func1)(void), void (*func2)(void)) {
  printf("começo");
  func1();
  printf("texto");
  func2();
  printf("fim");
}


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

x86 assembly (clang, -O2):
<comeco_fim>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
call   *%rbx
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
call   *%r14
lea    0xed0(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"come\C3\A7o\00"
@.str.1 = [6 x i8] c"texto\00"
@.str.2 = [4 x i8] c"fim\00"
define void @comeco_fim(void ()* %0, void ()* %1) {
%3 = alloca void ()*
%4 = alloca void ()*
store void ()* %0, void ()** %3
store void ()* %1, void ()** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = load void ()*, void ()** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = load void ()*, void ()** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"come\C3\A7o\00"
@.str.1 = [6 x i8] c"texto\00"
@.str.2 = [4 x i8] c"fim\00"
define void @comeco_fim(void ()* nocapture %0, void ()* nocapture %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
tail call void %0()
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
tail call void %1()
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int test2(unsigned int b) {
  if ((b >> 3) & 134217728)
    foo();
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x3,%eax
and    $0x8000000,%eax
cmp    $0x0,%eax
je     1136 <test2+0x26>
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
test   $0x40000000,%edi
je     1124 <test2+0x14>
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @test2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = lshr i32 %4, 3
%6 = and i32 %5, 134217728
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @foo()
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @test2(i32 %0) {
%2 = and i32 %0, 1073741824
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @foo()
br label %6
6: ; preds = %4, %1
ret i32 undef
}
int test_imm_91uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x91 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_91uint64_highword_reg>:
movabs $0x9100000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_91uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 622770257920
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ ftell(int /*<<< orphan*/ *);
uint32_t filesize(FILE *f) {
  uint32_t filesize;
  fseek(f, 0, SEEK_END);
  filesize = ftell(f);
  fseek(f, 0, SEEK_SET);
  return filesize;
}


x86 assembly (clang, -O0):
<filesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filesize>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @filesize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @ftell(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %9, i32 0, i32 %10)
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @filesize(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i32 @ftell(i32* %0)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
ret i32 %4
}
int do_491() { return 491; }


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

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

LLVM IR (-O0):
define i32 @do_491() {
ret i32 491
}

LLVM IR (-O2):
define i32 @do_491() {
ret i32 491
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0xeb() {
  Assert_real((isupper(235) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isupper.c",
              1180, ("isupper should be 0 for 0xeb"));
}


x86 assembly (clang, -O0):
<t_isupper_0xeb>:
push   %rbp
mov    %rsp,%rbp
mov    $0xeb,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x49c,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0xeb>:
push   %rax
mov    $0xeb,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x49c,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xeb\00"
define void @t_isupper_0xeb() {
%1 = call i64 @isupper(i32 235)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1180, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xeb\00"
define void @t_isupper_0xeb() {
%1 = tail call i64 @isupper(i32 235)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1180, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int add_channel(int, char const *);
int find_channel_index(int, char const *);
int create_channel(int server_index, const char *channel) {
  int channel_index = find_channel_index(server_index, channel);
  if (channel_index == -1)
    channel_index = add_channel(server_index, channel);
  return channel_index;
}


x86 assembly (clang, -O0):
<create_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <find_channel_index@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1157 <create_channel+0x37>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <add_channel@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_channel>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <find_channel_index@plt>
cmp    $0xffffffff,%eax
je     1139 <create_channel+0x19>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <add_channel@plt>

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

LLVM IR (-O2):
define i32 @create_channel(i32 %0, i8* %1) {
%3 = tail call i32 @find_channel_index(i32 %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @add_channel(i32 %0, i8* %1)
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ reqbuf;

/* Variables and functions */
int ph_rpc(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int phRejectCall(int cid, int reason) {
  char reqbuf[64];
  snprintf(reqbuf, sizeof(reqbuf), "REJECT CID=%d REASON=%d", cid, reason);
  return ph_rpc(reqbuf);
}


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

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

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

LLVM IR (-O2):
@.str = [24 x i8] c"REJECT CID=%d REASON=%d\00"
define i32 @phRejectCall(i32 %0, i32 %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%6 = call i32 @ph_rpc(i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ __map2check_main__();
int main() {
  __map2check_main__();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__map2check_main__@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__map2check_main__()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hanoi(int, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
void main(void) {
  int num;
  scanf("%d", &num);
  hanoi(num, 1, 3, 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <hanoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <hanoi@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @hanoi(i32 %4, i32 1, i32 3, i32 2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void init_header(FILE *f) { fseek(f, 2048, SEEK_SET); }


x86 assembly (clang, -O0):
<init_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
mov    $0x800,%esi
call   1030 <fseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_header>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
mov    $0x800,%esi
jmp    1030 <fseek@plt>

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

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @init_header(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_SET
%3 = tail call i32 @fseek(i32* %0, i32 2048, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("%lu", sizeof(unsigned long));
  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)
lea    0xed3(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\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 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}
void gdk_window_get_toplevels() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_get_toplevels() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int, int);
main() { f(1, 2, 3); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 1, i32 2, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1, i32 2, i32 3)
ret i32 0
}
f() {
  _Static_assert(__builtin_constant_p((char)5678), "cast not a constant");
  return (char)5678;
}


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

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

LLVM IR (-O0):
define i32 @f() {
ret i32 46
}

LLVM IR (-O2):
define i32 @f() {
ret i32 46
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
int /*<<< orphan*/ byte_swap_int(int *, int /*<<< orphan*/);
void byte_swap_float(float *buffer, uint number_of_swaps) {
  byte_swap_int((int *)buffer, number_of_swaps);
}


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

x86 assembly (clang, -O2):
<byte_swap_float>:
jmp    1030 <byte_swap_int@plt>

LLVM IR (-O0):
define void @byte_swap_float(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
%5 = load float*, float** %3
%6 = bitcast float* %5 to i32*
%7 = load i32, i32* %4
%8 = call i32 @byte_swap_int(i32* %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @byte_swap_float(float* %0, i32 %1) {
%3 = bitcast float* %0 to i32*
%4 = tail call i32 @byte_swap_int(i32* %3, i32 %1)
ret void
}
char *backup(q)
char *q;
{
  while (*q != ' ' && *q != '*')
    q--;
  return (q + 1);
}


x86 assembly (clang, -O0):
<backup>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     112d <backup+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <backup+0x3d>
jmp    114e <backup+0x4e>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <backup+0x8>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<backup>:
mov    %rdi,%rax
add    $0x1,%rax
nopw   0x0(%rax,%rax,1)
movzbl -0x1(%rax),%ecx
cmp    $0x20,%cl
je     1124 <backup+0x24>
cmp    $0x2a,%cl
je     1124 <backup+0x24>
add    $0xffffffffffffffff,%rax
jmp    1110 <backup+0x10>
ret

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

LLVM IR (-O2):
define i8* @backup(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 32, label %7
i8 42, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 -1
br label %2
7: ; preds = %2, %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ util_prg_print_parse_error();
int /*<<< orphan*/ warnx(char *);
void misc_print_missing_sub_command(void) {
  warnx("Subcommand is required");
  util_prg_print_parse_error();
}


x86 assembly (clang, -O0):
<misc_print_missing_sub_command>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <warnx@plt>
mov    $0x0,%al
call   1030 <util_prg_print_parse_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<misc_print_missing_sub_command>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <warnx@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <util_prg_print_parse_error@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Subcommand is required\00"
define void @misc_print_missing_sub_command() {
%1 = call i32 @warnx(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @util_prg_print_parse_error()
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Subcommand is required\00"
define void @misc_print_missing_sub_command() {
%1 = tail call i32 @warnx(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @util_prg_print_parse_error()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int reverseShort(short);
int main(int argc, char *argv[]) { printf("%d", reverseShort((short)1234)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4d2,%edi
call   1040 <reverseShort@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @reverseShort(i16 signext 1234)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @reverseShort(i16 signext 1234)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ crypt(char *, char *);
char *strdup(int /*<<< orphan*/);
char *pwhash(char *passwd) { return strdup(crypt(passwd, "$6$")); }


x86 assembly (clang, -O0):
<pwhash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <crypt@plt>
mov    %eax,%edi
call   1040 <strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwhash>:
push   %rax
lea    0xed8(%rip),%rsi
call   1030 <crypt@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <strdup@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"$6$\00"
define i8* @pwhash(i8* %0) {
%2 = tail call i32 @crypt(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @strdup(i32 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cgiTableFieldEnd() { printf("</TD>\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"</TD>\00"
define void @cgiTableFieldEnd() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ disk_identify_get_string(int /*<<< orphan*/ *, unsigned int,
                                            char *, size_t);
void disk_identify_fixup_string(uint8_t identify[512],
                                unsigned int offset_words, size_t len) {
  disk_identify_get_string(identify, offset_words,
                           (char *)identify + offset_words * 2, len);
}


x86 assembly (clang, -O0):
<disk_identify_fixup_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x18(%rbp),%rcx
call   1030 <disk_identify_get_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disk_identify_fixup_string>:
mov    %rdx,%rcx
lea    (%rsi,%rsi,1),%edx
add    %rdi,%rdx
jmp    1030 <disk_identify_get_string@plt>

LLVM IR (-O0):
define void @disk_identify_fixup_string(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %4
%10 = bitcast i32* %9 to i8*
%11 = load i32, i32* %5
%12 = mul i32 %11, 2
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i64, i64* %6
%16 = call i32 @disk_identify_get_string(i32* %7, i32 %8, i8* %14, i64 %15)
ret void
}

LLVM IR (-O2):
define void @disk_identify_fixup_string(i32* %0, i32 %1, i64 %2) {
%4 = bitcast i32* %0 to i8*
%5 = shl i32 %1, 1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
%8 = tail call i32 @disk_identify_get_string(i32* %0, i32 %1, i8* %7, i64 %2)
ret void
}
int foo(unsigned a, unsigned b) {
  if (a == b)
    return 1;
  if (a > b)
    return 2;
  if (a < b)
    return 3;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1122 <foo+0x22>
movl   $0x1,-0x4(%rbp)
jmp    1159 <foo+0x59>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jbe    113a <foo+0x3a>
movl   $0x2,-0x4(%rbp)
jmp    1159 <foo+0x59>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1152 <foo+0x52>
movl   $0x3,-0x4(%rbp)
jmp    1159 <foo+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x1,%eax
cmp    %esi,%edi
je     1119 <foo+0x19>
mov    $0x2,%eax
ja     1119 <foo+0x19>
setb   %al
movzbl %al,%eax
lea    (%rax,%rax,2),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = icmp ugt i32 %0, %1
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = icmp ult i32 %0, %1
%8 = select i1 %7, i32 3, i32 0
br label %9
9: ; preds = %6, %4, %2
%10 = phi i32 [ 1, %2 ], [ 2, %4 ], [ %8, %6 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t *write_u16(uint8_t *p, const uint16_t v) {
  *p++ = (v >> 8) & 0xFF;
  *p++ = (v >> 0) & 0xFF;
  return (p);
}


x86 assembly (clang, -O0):
<write_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x8(%rbp)
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_u16>:
mov    %esi,%eax
movzbl %ah,%ecx
mov    %ecx,(%rdi)
movzbl %al,%eax
mov    %eax,0x4(%rdi)
lea    0x8(%rdi),%rax
ret

LLVM IR (-O0):
define i32* @write_u16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i32 1
store i32* %9, i32** %3
store i32 %7, i32* %8
%10 = load i32, i32* %4
%11 = ashr i32 %10, 0
%12 = and i32 %11, 255
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %3
store i32 %12, i32* %13
%15 = load i32*, i32** %3
ret i32* %15
}

LLVM IR (-O2):
define i32* @write_u16(i32* writeonly %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = and i32 %3, 255
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %0
%6 = and i32 %1, 255
%7 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %6, i32* %5
ret i32* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ *open_logfile();
void LOG_MESSAGE(char *msg) {
  FILE *f;
  f = open_logfile();
  fprintf(f, "[D] %s\n", msg);
  fclose(f);
}


x86 assembly (clang, -O0):
<LOG_MESSAGE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <open_logfile@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeaa(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LOG_MESSAGE>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <open_logfile@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"[D] %s\0A\00"
define void @LOG_MESSAGE(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = call i32* (...) @open_logfile()
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = load i8*, i8** %2
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32*, i32** %3
%9 = call i32 @fclose(i32* %8)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"[D] %s\0A\00"
define void @LOG_MESSAGE(i8* %0) {
%2 = tail call i32* (...) @open_logfile()
%3 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @fclose(i32* %2)
ret void
}
unsigned addval_115(unsigned x) { return x + 2430634824U; }


x86 assembly (clang, -O0):
<addval_115>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90e08b48,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addval_115>:
lea    -0x6f1f74b8(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @addval_115(i32 %0) {
%2 = add i32 %0, -1864332472
ret i32 %2
}
int divRoundDown(int n, int s) { return n / s; }


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

x86 assembly (clang, -O2):
<divRoundDown>:
mov    %edi,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @divRoundDown(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
unsigned long return_ulong_1() { return 1073741824; }


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

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

LLVM IR (-O0):
define i64 @return_ulong_1() {
ret i64 1073741824
}

LLVM IR (-O2):
define i64 @return_ulong_1() {
ret i64 1073741824
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int getpid();
int getppid();
int gettid();
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
int main() {
  int fret = fork();
  int pid = getpid();
  int ppid = getppid();
  int tid = gettid();
  printf("[%d]: pid = %d, tid = %d, ppid = %d, forkret = %d\n", pid, pid, tid,
         ppid, fret);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <fork@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <getppid@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <gettid@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x8(%rbp),%r9d
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1080 <fork@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <gettid@plt>
lea    0xe72(%rip),%rdi
mov    %ebp,%esi
mov    %ebp,%edx
mov    %eax,%ecx
mov    %ebx,%r8d
mov    %r14d,%r9d
call   1050 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"[%d]: pid = %d, tid = %d, ppid = %d, forkret = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @fork()
store i32 %6, i32* %2
%7 = call i32 (...) @getpid()
store i32 %7, i32* %3
%8 = call i32 (...) @getppid()
store i32 %8, i32* %4
%9 = call i32 (...) @gettid()
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12, i32 %13, i32 %14)
%16 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [51 x i8] c"[%d]: pid = %d, tid = %d, ppid = %d, forkret = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @getppid()
%4 = tail call i32 (...) @gettid()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2, i32 %4, i32 %3, i32 %1)
%6 = tail call i32 @exit(i32 0)
unreachable
}