xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ recurser_void1(int);
int /*<<< orphan*/ track(int);
void recurser_void2(int n) {
  if (n == 0 || n == 7 || n == 8)
    track(n);
  if (n == 10)
    return;
  recurser_void1(n + 1);
}


x86 assembly (clang, -O0):
<recurser_void2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1149 <recurser_void2+0x29>
cmpl   $0x7,-0x4(%rbp)
je     1149 <recurser_void2+0x29>
cmpl   $0x8,-0x4(%rbp)
jne    1151 <recurser_void2+0x31>
mov    -0x4(%rbp),%edi
call   1040 <track@plt>
cmpl   $0xa,-0x4(%rbp)
jne    1160 <recurser_void2+0x40>
jmp    116b <recurser_void2+0x4b>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <recurser_void1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recurser_void2>:
push   %rbx
mov    %edi,%ebx
lea    -0x7(%rbx),%eax
cmp    $0x2,%eax
jb     1134 <recurser_void2+0x14>
cmp    $0xa,%ebx
je     1146 <recurser_void2+0x26>
test   %ebx,%ebx
jne    113b <recurser_void2+0x1b>
mov    %ebx,%edi
call   1040 <track@plt>
add    $0x1,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <recurser_void1@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @recurser_void2(i32 %0) {
switch i32 %0, label %4 [
i32 8, label %2
i32 7, label %2
i32 0, label %2
i32 10, label %7
]
2: ; preds = %1, %1, %1
%3 = tail call i32 @track(i32 %0)
br label %4
4: ; preds = %2, %1
%5 = add nsw i32 %0, 1
%6 = tail call i32 @recurser_void1(i32 %5)
br label %7
7: ; preds = %1, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void nrerror(const char *error_text) {
  fprintf(stderr, "Numerical Recipes run-time error...\n");
  fprintf(stderr, "%s\n", error_text);
  fprintf(stderr, "...now exiting to system...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<nrerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<nrerror>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xedc(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Numerical Recipes run-time error...\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [29 x i8] c"...now exiting to system...\0A\00"
define void @nrerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Numerical Recipes run-time error...\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [29 x i8] c"...now exiting to system...\0A\00"
define void @nrerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
char *langRomTypeSvi328Uart() { return "SVI-328 Serial Port"; }


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

x86 assembly (clang, -O2):
<langRomTypeSvi328Uart>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [20 x i8] c"SVI-328 Serial Port\00"
define i8* @langRomTypeSvi328Uart() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [20 x i8] c"SVI-328 Serial Port\00"
define i8* @langRomTypeSvi328Uart() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ pippo();
int main(int ac, char *av[]) {
  pippo();
  return 0;
}


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

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

LLVM IR (-O0):
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 (...) @pippo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @pippo()
ret i32 0
}
/* Variables and functions */
int atoi(char const *);
int switch_safe_atoi(const char *nptr, int dft) {
  return nptr ? atoi(nptr) : dft;
}


x86 assembly (clang, -O0):
<switch_safe_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113b <switch_safe_atoi+0x2b>
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x10(%rbp)
jmp    1141 <switch_safe_atoi+0x31>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<switch_safe_atoi>:
test   %rdi,%rdi
je     111a <switch_safe_atoi+0xa>
jmp    1030 <atoi@plt>
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @switch_safe_atoi(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @atoi(i8* %0)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ %1, %2 ]
ret i32 %7
}
int block_job_iostatus_reset() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @block_job_iostatus_reset() {
ret i32 0
}
/* Type definitions */
struct ptp_clock_caps {
  int dummy;
};
typedef int clockid_t;

/* Variables and functions */
int /*<<< orphan*/ PTP_CLOCK_GETCAPS;
int ioctl(int, int /*<<< orphan*/, struct ptp_clock_caps *);
int /*<<< orphan*/ perror(char *);
int phc_get_caps(clockid_t clkid, struct ptp_clock_caps *caps) {
  int fd = ((unsigned int)~((clkid) >> 3)), err;
  err = ioctl(fd, PTP_CLOCK_GETCAPS, caps);
  if (err)
    perror("PTP_CLOCK_GETCAPS");
  return err;
}


x86 assembly (clang, -O0):
<phc_get_caps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1169 <phc_get_caps+0x49>
lea    0xe9c(%rip),%rdi
call   1040 <perror@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phc_get_caps>:
push   %rbx
mov    %rsi,%rdx
sar    $0x3,%edi
not    %edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1141 <phc_get_caps+0x21>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb8(%rip),%rdi
call   1040 <perror@plt>
jmp    113d <phc_get_caps+0x1d>

LLVM IR (-O0):
%struct.ptp_clock_caps = type { i32 }
@PTP_CLOCK_GETCAPS = global i32 0
@.str = [18 x i8] c"PTP_CLOCK_GETCAPS\00"
define i32 @phc_get_caps(i32 %0, %struct.ptp_clock_caps* %1) {
%3 = alloca i32
%4 = alloca %struct.ptp_clock_caps*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store %struct.ptp_clock_caps* %1, %struct.ptp_clock_caps** %4
%7 = load i32, i32* %3
%8 = ashr i32 %7, 3
%9 = xor i32 %8, -1
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* @PTP_CLOCK_GETCAPS
%12 = load %struct.ptp_clock_caps*, %struct.ptp_clock_caps** %4
%13 = call i32 @ioctl(i32 %10, i32 %11, %struct.ptp_clock_caps* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
%struct.ptp_clock_caps = type { i32 }
@PTP_CLOCK_GETCAPS = global i32 0
@.str = [18 x i8] c"PTP_CLOCK_GETCAPS\00"
define i32 @phc_get_caps(i32 %0, %struct.ptp_clock_caps* %1) {
%3 = ashr i32 %0, 3
%4 = xor i32 %3, -1
%5 = load i32, i32* @PTP_CLOCK_GETCAPS
%6 = tail call i32 @ioctl(i32 %4, i32 %5, %struct.ptp_clock_caps* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ integerToString(int);
int /*<<< orphan*/ test(int /*<<< orphan*/, char *);
void testIntegerToString(void) {
  test(integerToString(0), "0");
  test(integerToString(1234567), "1234567");
  test(integerToString(-17), "-17");
}


x86 assembly (clang, -O0):
<testIntegerToString>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <integerToString@plt>
mov    %eax,%edi
lea    0xecc(%rip),%rsi
call   1040 <test@plt>
mov    $0x12d687,%edi
call   1030 <integerToString@plt>
mov    %eax,%edi
lea    0xeb6(%rip),%rsi
call   1040 <test@plt>
mov    $0xffffffef,%edi
call   1030 <integerToString@plt>
mov    %eax,%edi
lea    0xea6(%rip),%rsi
call   1040 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testIntegerToString>:
push   %rax
xor    %edi,%edi
call   1030 <integerToString@plt>
lea    0xed1(%rip),%rsi
mov    %eax,%edi
call   1040 <test@plt>
mov    $0x12d687,%edi
call   1030 <integerToString@plt>
lea    0xebb(%rip),%rsi
mov    %eax,%edi
call   1040 <test@plt>
mov    $0xffffffef,%edi
call   1030 <integerToString@plt>
lea    0xeab(%rip),%rsi
mov    %eax,%edi
pop    %rax
jmp    1040 <test@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [8 x i8] c"1234567\00"
@.str.2 = [4 x i8] c"-17\00"
define void @testIntegerToString() {
%1 = call i32 @integerToString(i32 0)
%2 = call i32 @test(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @integerToString(i32 1234567)
%4 = call i32 @test(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @integerToString(i32 -17)
%6 = call i32 @test(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [8 x i8] c"1234567\00"
@.str.2 = [4 x i8] c"-17\00"
define void @testIntegerToString() {
%1 = tail call i32 @integerToString(i32 0)
%2 = tail call i32 @test(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @integerToString(i32 1234567)
%4 = tail call i32 @test(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @integerToString(i32 -17)
%6 = tail call i32 @test(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void dojoy(void) {}


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

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

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

LLVM IR (-O2):
define void @dojoy() {
ret void
}
/* Variables and functions */
int bbm_word_write(void *, unsigned short, unsigned short);
int bbm_com_word_write(void *handle, unsigned short addr, unsigned short data) {
  int res;
  res = bbm_word_write(handle, addr, data);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_word_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzwl %ax,%esi
movzwl -0xc(%rbp),%edx
call   1030 <bbm_word_write@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_word_write>:
jmp    1030 <bbm_word_write@plt>

LLVM IR (-O0):
define i32 @bbm_com_word_write(i8* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
%7 = alloca i32
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%8 = load i8*, i8** %4
%9 = load i16, i16* %5
%10 = load i16, i16* %6
%11 = call i32 @bbm_word_write(i8* %8, i16 zeroext %9, i16 zeroext %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @bbm_com_word_write(i8* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = tail call i32 @bbm_word_write(i8* %0, i16 zeroext %1, i16 zeroext %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, int);
main() {
  int c;
  while (c = (getchar() != EOF)) {
    printf("Inside while: %d\n", c);
  }
  printf("Outside while: %d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2eab(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x8(%rbp)
test   $0x1,%al
jne    115b <main+0x3b>
jmp    116f <main+0x4f>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%rax
je     1159 <main+0x39>
lea    0xec2(%rip),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%rax
jne    1140 <main+0x20>
lea    0xeb2(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [18 x i8] c"Inside while: %d\0A\00"
@.str.1 = [19 x i8] c"Outside while: %d\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @getchar()
%2 = load i64, i64* @EOF
%3 = icmp eq i64 %1, %2
br i1 %3, label %9, label %4
4: ; preds = %0, %4
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = tail call i64 (...) @getchar()
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %4
9: ; preds = %4, %0
%10 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret i32 0
}
int IL_re_search(bufp, string, size, startpos, range, regs)
struct re_pattern_buffer *bufp;
const char *string;
int size, startpos, range;
struct re_registers *regs;
{
  return IL_re_search_2(bufp, (void *)0, 0, string, size, startpos, range, regs,
                        size);
}


x86 assembly (clang, -O0):
<IL_re_search>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%r11d
mov    -0x28(%rbp),%r10
mov    -0x14(%rbp),%eax
xor    %edx,%edx
mov    %edx,%esi
xor    %edx,%edx
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1030 <IL_re_search_2@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IL_re_search>:
push   %rax
mov    %r9,%r10
mov    %r8d,%r11d
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %rsi,%rcx
sub    $0x8,%rsp
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
push   %r8
push   %r10
push   %r11
call   1030 <IL_re_search_2@plt>
add    $0x20,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @IL_re_search(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, i32 %4, %struct.re_registers* %5) {
%7 = alloca %struct.re_pattern_buffer*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.re_registers*
store %struct.re_pattern_buffer* %0, %struct.re_pattern_buffer** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store %struct.re_registers* %5, %struct.re_registers** %12
%13 = load %struct.re_pattern_buffer*, %struct.re_pattern_buffer** %7
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load %struct.re_registers*, %struct.re_registers** %12
%19 = load i32, i32* %9
%20 = call i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, ...) bitcast (i32 (...)* @IL_re_search_2 to i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, ...)*)(%struct.re_pattern_buffer* %13, i8* null, i32 0, i8* %14, i32 %15, i32 %16, i32 %17, %struct.re_registers* %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @IL_re_search(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i32 %3, i32 %4, %struct.re_registers* %5) {
%7 = tail call i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, ...) bitcast (i32 (...)* @IL_re_search_2 to i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, ...)*)(%struct.re_pattern_buffer* %0, i8* null, i32 0, i8* %1, i32 %2, i32 %3, i32 %4, %struct.re_registers* %5, i32 %2)
ret i32 %7
}
void tcp_synack(struct Squirrel *squirrel, struct NetFrame *frame) {
  squirrel = (squirrel);
  frame = (frame);
}


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

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

LLVM IR (-O0):
%struct.Squirrel = type opaque
%struct.NetFrame = type opaque
define void @tcp_synack(%struct.Squirrel* %0, %struct.NetFrame* %1) {
%3 = alloca %struct.Squirrel*
%4 = alloca %struct.NetFrame*
store %struct.Squirrel* %0, %struct.Squirrel** %3
store %struct.NetFrame* %1, %struct.NetFrame** %4
%5 = load %struct.Squirrel*, %struct.Squirrel** %3
store %struct.Squirrel* %5, %struct.Squirrel** %3
%6 = load %struct.NetFrame*, %struct.NetFrame** %4
store %struct.NetFrame* %6, %struct.NetFrame** %4
ret void
}

LLVM IR (-O2):
%struct.Squirrel = type opaque
%struct.NetFrame = type opaque
define void @tcp_synack(%struct.Squirrel* nocapture %0, %struct.NetFrame* nocapture %1) {
ret void
}
/* Variables and functions */
int virt_readlink(char const *, char *, size_t, int);
int _readlink(const char *path, char *buf, size_t bufsiz) {
  return virt_readlink(path, buf, bufsiz, 1);
}


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

x86 assembly (clang, -O2):
<_readlink>:
mov    $0x1,%ecx
jmp    1030 <virt_readlink@plt>

LLVM IR (-O0):
define i32 @_readlink(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @virt_readlink(i8* %7, i8* %8, i64 %9, i32 1)
ret i32 %10
}

LLVM IR (-O2):
define i32 @_readlink(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @virt_readlink(i8* %0, i8* %1, i64 %2, i32 1)
ret i32 %4
}
/* Variables and functions */
unsigned char peek2(unsigned short, unsigned short);
unsigned char peek3(unsigned short int seg, unsigned short int offset) {
  return peek2(seg, offset);
}


x86 assembly (clang, -O0):
<peek3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzwl -0x4(%rbp),%esi
call   1030 <peek2@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peek3>:
jmp    1030 <peek2@plt>

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

LLVM IR (-O2):
define zeroext i8 @peek3(i16 zeroext %0, i16 zeroext %1) {
%3 = tail call zeroext i8 @peek2(i16 zeroext %0, i16 zeroext %1)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Usage: xorimage [-i infile] [-o outfile] [-p <pattern>] [-x]\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [62 x i8] c"Usage: xorimage [-i infile] [-o outfile] [-p <pattern>] [-x]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [62 x i8] c"Usage: xorimage [-i infile] [-o outfile] [-p <pattern>] [-x]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void expandString(s, len, c) char *s, c;
int len;
{
  int i;
  i = strlen(s);
  while (i < len) {
    s[i] = c;
    i++;
  }
  s[len] = 0;
}


x86 assembly (clang, -O0):
<expandString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <expandString+0x48>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <expandString+0x20>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expandString>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    %ebp,%eax
jge    114e <expandString+0x2e>
movslq %eax,%rdi
add    %rbx,%rdi
not    %eax
add    %ebp,%eax
add    $0x1,%rax
mov    %r14d,%esi
mov    %rax,%rdx
call   1040 <memset@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @expandString(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = trunc i64 %4 to i32
%6 = icmp slt i32 %5, %1
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = trunc i32 %2 to i8
%9 = shl i64 %4, 32
%10 = ashr exact i64 %9, 32
%11 = getelementptr i8, i8* %0, i64 %10
%12 = xor i32 %5, -1
%13 = add i32 %12, %1
%14 = zext i32 %13 to i64
%15 = add nuw nsw i64 %14, 1
br label %16
16: ; preds = %7, %3
%17 = sext i32 %1 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 0, i8* %18
ret void
}
int test_imm_0Auint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x0A << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_0Auint64_highword_mem>:
testb  $0xa,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Auint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 42949672960
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int solve_me_first(int a, int b) { return a + b; }


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

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

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

LLVM IR (-O2):
define i32 @solve_me_first(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_RADIO_GIO1_PIN() { return 0x01 & (inp_emulate(-2) >> 7); }


x86 assembly (clang, -O0):
<TOSH_READ_RADIO_GIO1_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
sar    $0x7,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_RADIO_GIO1_PIN>:
push   %rax
mov    $0xfffffffe,%edi
call   1030 <inp_emulate@plt>
shr    $0x7,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_RADIO_GIO1_PIN() {
%1 = call i32 @inp_emulate(i32 -2)
%2 = ashr i32 %1, 7
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_RADIO_GIO1_PIN() {
%1 = tail call i32 @inp_emulate(i32 -2)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 7
ret i8 %3
}
void d2i_ASN1_INTEGER(void) {}


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

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

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

LLVM IR (-O2):
define void @d2i_ASN1_INTEGER() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void vgStartOffScreenSH(void *oscontext, int width, int height) {
  printf("vgStartOffScreenSH not implemented!\n");
}


x86 assembly (clang, -O0):
<vgStartOffScreenSH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [37 x i8] c"vgStartOffScreenSH not implemented!\0A\00"
define void @vgStartOffScreenSH(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"vgStartOffScreenSH not implemented!\00"
define void @vgStartOffScreenSH(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perf_disable_clock();
void perf_reset_clock(void) {
  perf_disable_clock();
  *(volatile unsigned int *)0xF8F00200 = 0;
  *(volatile unsigned int *)0xF8F00204 = 0;
}


x86 assembly (clang, -O0):
<perf_reset_clock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <perf_disable_clock@plt>
mov    $0xf8f00200,%eax
movl   $0x0,(%rax)
mov    $0xf8f00204,%eax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<perf_reset_clock>:
push   %rax
xor    %eax,%eax
call   1030 <perf_disable_clock@plt>
mov    $0xf8f00200,%eax
movl   $0x0,(%rax)
movl   $0x0,0x4(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @perf_reset_clock() {
%1 = call i32 (...) @perf_disable_clock()
store volatile i32 0, i32* inttoptr (i64 4176478720 to i32*)
store volatile i32 0, i32* inttoptr (i64 4176478724 to i32*)
ret void
}

LLVM IR (-O2):
define void @perf_reset_clock() {
%1 = tail call i32 (...) @perf_disable_clock()
store volatile i32 0, i32* inttoptr (i64 4176478720 to i32*)
store volatile i32 0, i32* inttoptr (i64 4176478724 to i32*)
ret void
}
int Random(x)
int x;
{ return ((rand() / 19) % x); }


x86 assembly (clang, -O0):
<Random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x13,%ecx
cltd
idiv   %ecx
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Random>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x6bca1af3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Random(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = sdiv i32 %3, 19
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @Random(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = sdiv i32 %2, 19
%4 = srem i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int atoi(scalar_t__);
int /*<<< orphan*/ memcpy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, char, int);
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strcspn(char *, char *);
void krad_get_host_and_port(char *string, char *host, int *port) {
  *port = atoi(strchr(string, ':') + 1);
  memset(host, '\0', 128);
  memcpy(host, string, strcspn(string, ":"));
}


x86 assembly (clang, -O0):
<krad_get_host_and_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1050 <strcspn@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1060 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<krad_get_host_and_port>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1030 <strchr@plt>
lea    0x1(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,(%r15)
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcspn@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <memcpy@plt>

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define void @krad_get_host_and_port(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = call i64 @strchr(i8* %7, i8 signext 58)
%9 = add nsw i64 %8, 1
%10 = call i32 @atoi(i64 %9)
%11 = load i32*, i32** %6
store i32 %10, i32* %11
%12 = load i8*, i8** %5
%13 = call i32 @memset(i8* %12, i8 signext 0, i32 128)
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = load i8*, i8** %4
%17 = call i32 @strcspn(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @memcpy(i8* %14, i8* %15, i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define void @krad_get_host_and_port(i8* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = tail call i64 @strchr(i8* %0, i8 signext 58)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @atoi(i64 %5)
store i32 %6, i32* %2
%7 = tail call i32 @memset(i8* %1, i8 signext 0, i32 128)
%8 = tail call i32 @strcspn(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @memcpy(i8* %1, i8* %0, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cube_reset();
int /*<<< orphan*/ init_SD();
void init_cube() {
  cube_reset();
  init_SD();
}


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

x86 assembly (clang, -O2):
<init_cube>:
push   %rax
xor    %eax,%eax
call   1040 <cube_reset@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <init_SD@plt>

LLVM IR (-O0):
define void @init_cube() {
%1 = call i32 (...) @cube_reset()
%2 = call i32 (...) @init_SD()
ret void
}

LLVM IR (-O2):
define void @init_cube() {
%1 = tail call i32 (...) @cube_reset()
%2 = tail call i32 (...) @init_SD()
ret void
}
/* Variables and functions */
int vrna_hamming_distance(char const *, char const *);
int hamming(const char *s1, const char *s2) {
  return vrna_hamming_distance(s1, s2);
}


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

x86 assembly (clang, -O2):
<hamming>:
jmp    1030 <vrna_hamming_distance@plt>

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

LLVM IR (-O2):
define i32 @hamming(i8* %0, i8* %1) {
%3 = tail call i32 @vrna_hamming_distance(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
float roundf(float);
float round1p(float x) { return roundf(10.0f * x) / 10.0f; }


x86 assembly (clang, -O0):
<round1p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
call   1030 <roundf@plt>
movss  0xec9(%rip),%xmm1
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round1p>:
push   %rax
mulss  0xee7(%rip),%xmm0
call   1030 <roundf@plt>
divss  0xeda(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @round1p(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float 1.000000e+01, %3
%5 = call float @llvm.round.f32(float %4)
%6 = fdiv float %5, 1.000000e+01
ret float %6
}

LLVM IR (-O2):
define float @round1p(float %0) {
%2 = fmul float %0, 1.000000e+01
%3 = tail call float @llvm.round.f32(float %2)
%4 = fdiv float %3, 1.000000e+01
ret float %4
}
/* Variables and functions */
int yyparse();
main() { return (yyparse()); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yyparse()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ExportedFunction();
int main() {
  ExportedFunction();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ExportedFunction()
ret i32 0
}
int isIntValueInRangeBetweenMinAndMax(int value, int min, int max) {
  return ((min <= value) && (value <= max));
}


x86 assembly (clang, -O0):
<isIntValueInRangeBetweenMinAndMax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     112a <isIntValueInRangeBetweenMinAndMax+0x2a>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isIntValueInRangeBetweenMinAndMax>:
cmp    %edi,%esi
setle  %al
cmp    %edx,%edi
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isIntValueInRangeBetweenMinAndMax(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = icmp sle i32 %11, %12
br label %14
14: ; preds = %10, %3
%15 = phi i1 [ false, %3 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @isIntValueInRangeBetweenMinAndMax(i32 %0, i32 %1, i32 %2) {
%4 = icmp sle i32 %1, %0
%5 = icmp sle i32 %0, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ glmExp23f(float *, float *);
void glmExp23f_(float x[3]) { glmExp23f(x, x); }


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

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

LLVM IR (-O0):
define void @glmExp23f_(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = load float*, float** %2
%5 = call i32 @glmExp23f(float* %3, float* %4)
ret void
}

LLVM IR (-O2):
define void @glmExp23f_(float* %0) {
%2 = tail call i32 @glmExp23f(float* %0, float* %0)
ret void
}
void bad_if_not_alias(int *x, int *y) {
  char a[1];
  if (x != y) {
    a[1] = 'B';
  }
}


x86 assembly (clang, -O0):
<bad_if_not_alias>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     111e <bad_if_not_alias+0x1e>
movb   $0x42,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @bad_if_not_alias(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [1 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** %4
%8 = icmp ne i32* %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 1
store i8 66, i8* %10
br label %11
11: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @bad_if_not_alias(i32* nocapture %0, i32* nocapture %1) {
ret void
}
void iowrite16(unsigned short port, unsigned short v) {
  __asm__ __volatile__("outw %0, %1" : : "a"(v), "d"(port));
}


x86 assembly (clang, -O0):
<iowrite16>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    -0x2(%rbp),%dx
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<iowrite16>:
mov    %esi,%eax
mov    %edi,%edx
out    %ax,(%dx)
ret

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

LLVM IR (-O2):
define void @iowrite16(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw $0, $1", "{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %1, i16 %0)
ret void
}
/* Type definitions */
struct pci_dev {
  int dummy;
};
struct pci_access {
  int dummy;
};

/* Variables and functions */
struct pci_dev *pci_acc_init(struct pci_access **, int /*<<< orphan*/,
                             int /*<<< orphan*/, int, int, int, int);
struct pci_dev *pci_slot_func_init(struct pci_access **pacc, int slot,
                                   int func) {
  return pci_acc_init(pacc, 0, 0, slot, func, -1, -1);
}


x86 assembly (clang, -O0):
<pci_slot_func_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
xor    %edx,%edx
mov    $0xffffffff,%r9d
mov    %edx,%esi
movl   $0xffffffff,(%rsp)
call   1030 <pci_acc_init@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pci_slot_func_init>:
push   %rax
mov    %edx,%r8d
mov    %esi,%ecx
movl   $0xffffffff,(%rsp)
xor    %esi,%esi
xor    %edx,%edx
mov    $0xffffffff,%r9d
call   1030 <pci_acc_init@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.pci_dev = type { i32 }
%struct.pci_access = type { i32 }
define %struct.pci_dev* @pci_slot_func_init(%struct.pci_access** %0, i32 %1, i32 %2) {
%4 = alloca %struct.pci_access**
%5 = alloca i32
%6 = alloca i32
store %struct.pci_access** %0, %struct.pci_access*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.pci_access**, %struct.pci_access*** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call %struct.pci_dev* @pci_acc_init(%struct.pci_access** %7, i32 0, i32 0, i32 %8, i32 %9, i32 -1, i32 -1)
ret %struct.pci_dev* %10
}

LLVM IR (-O2):
%struct.pci_dev = type { i32 }
%struct.pci_access = type { i32 }
define %struct.pci_dev* @pci_slot_func_init(%struct.pci_access** %0, i32 %1, i32 %2) {
%4 = tail call %struct.pci_dev* @pci_acc_init(%struct.pci_access** %0, i32 0, i32 0, i32 %1, i32 %2, i32 -1, i32 -1)
ret %struct.pci_dev* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int i = 0x10;
  printf("\n%d", i);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 16)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ prg16setBank1(int);
void m180_setParams(uint16_t addr, uint8_t val) {
  (void)addr;
  prg16setBank1((val & 0xF) << 14);
}


x86 assembly (clang, -O0):
<m180_setParams>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
and    $0xf,%edi
shl    $0xe,%edi
call   1030 <prg16setBank1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m180_setParams>:
mov    %esi,%edi
and    $0xf,%edi
shl    $0xe,%edi
jmp    1030 <prg16setBank1@plt>

LLVM IR (-O0):
define void @m180_setParams(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 = and i32 %6, 15
%8 = shl i32 %7, 14
%9 = call i32 @prg16setBank1(i32 %8)
ret void
}

LLVM IR (-O2):
define void @m180_setParams(i32 %0, i32 %1) {
%3 = shl i32 %1, 14
%4 = and i32 %3, 245760
%5 = tail call i32 @prg16setBank1(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _bad_stack_set(int);
void stack_zero(void) { _bad_stack_set(0x0); }


x86 assembly (clang, -O0):
<stack_zero>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <_bad_stack_set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stack_zero>:
xor    %edi,%edi
jmp    1030 <_bad_stack_set@plt>

LLVM IR (-O0):
define void @stack_zero() {
%1 = call i32 @_bad_stack_set(i32 0)
ret void
}

LLVM IR (-O2):
define void @stack_zero() {
%1 = tail call i32 @_bad_stack_set(i32 0)
ret void
}