xunge/DecIR huggingface dataset:
void pinmux_show_setting(struct seq_file *s,
                         struct pinctrl_setting const *setting) {}


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

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

LLVM IR (-O0):
%struct.seq_file = type opaque
%struct.pinctrl_setting = type opaque
define void @pinmux_show_setting(%struct.seq_file* %0, %struct.pinctrl_setting* %1) {
%3 = alloca %struct.seq_file*
%4 = alloca %struct.pinctrl_setting*
store %struct.seq_file* %0, %struct.seq_file** %3
store %struct.pinctrl_setting* %1, %struct.pinctrl_setting** %4
ret void
}

LLVM IR (-O2):
%struct.seq_file = type opaque
%struct.pinctrl_setting = type opaque
define void @pinmux_show_setting(%struct.seq_file* nocapture %0, %struct.pinctrl_setting* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
char getchar();
void main() {
  FILE *fp;
  char x;
  fp = fopen("abc.txt", "w");
  while ((x = getchar()) != '\n') {
    fputc(x, fp);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1189 <main+0x49>
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
jmp    115f <main+0x1f>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1178 <main+0x38>
movsbl %al,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
jmp    1160 <main+0x20>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"abc.txt\00"
@.str.1 = [2 x i8] c"w\00"
define void @main() {
%1 = alloca i32*
%2 = alloca i8
%3 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
br label %4
4: ; preds = %8, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i8, i8* %2
%10 = load i32*, i32** %1
%11 = call i32 @fputc(i8 signext %9, i32* %10)
br label %4
12: ; preds = %4
%13 = load i32*, i32** %1
%14 = call i32 @fclose(i32* %13)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"abc.txt\00"
@.str.1 = [2 x i8] c"w\00"
define void @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %9, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %7, %4 ], [ %2, %0 ]
%6 = tail call i32 @fputc(i8 signext %5, i32* %1)
%7 = tail call signext i8 (...) @getchar()
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %4
9: ; preds = %4, %0
%10 = tail call i32 @fclose(i32* %1)
ret void
}
int ptraceTraceMe() { return -1; }


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

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

LLVM IR (-O0):
define i32 @ptraceTraceMe() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @ptraceTraceMe() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *last_rom_path();
int /*<<< orphan*/ moo_load_rom(char *);
void load_last_rom() {
  char *path = last_rom_path();
  moo_load_rom(path);
  free(path);
}


x86 assembly (clang, -O0):
<load_last_rom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <last_rom_path@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <moo_load_rom@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_last_rom>:
push   %rbx
xor    %eax,%eax
call   1050 <last_rom_path@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <moo_load_rom@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @load_last_rom() {
%1 = alloca i8*
%2 = call i8* (...) @last_rom_path()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @moo_load_rom(i8* %3)
%5 = load i8*, i8** %1
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @load_last_rom() {
%1 = tail call i8* (...) @last_rom_path()
%2 = tail call i32 @moo_load_rom(i8* %1)
%3 = tail call i32 @free(i8* %1)
ret void
}
int xmlUCSIsGreekandCoptic(int code) {
  return (((code >= 0x0370) && (code <= 0x03FF)));
}


x86 assembly (clang, -O0):
<xmlUCSIsGreekandCoptic>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x370,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsGreekandCoptic+0x26>
cmpl   $0x3ff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsGreekandCoptic>:
add    $0xfffffc90,%edi
xor    %eax,%eax
cmp    $0x90,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @xmlUCSIsGreekandCoptic(i32 %0) {
%2 = add i32 %0, -880
%3 = icmp ult i32 %2, 144
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SOL_PACKET;
int /*<<< orphan*/ SO_ERROR;
int /*<<< orphan*/ getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int *);
int socket_get_error(int sock) {
  int size, err;
  size = sizeof(int);
  err = 0;
  getsockopt(sock, SOL_PACKET, SO_ERROR, &err, &size);
  return (err);
}


x86 assembly (clang, -O0):
<socket_get_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
mov    0x2e9c(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
lea    -0x8(%rbp),%r8
call   1030 <getsockopt@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_get_error>:
push   %rax
movl   $0x4,0x4(%rsp)
movl   $0x0,(%rsp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
lea    0x4(%rsp),%r8
call   1030 <getsockopt@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOL_PACKET = global i32 0
@SO_ERROR = global i32 0
define i32 @socket_get_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* @SOL_PACKET
%7 = load i32, i32* @SO_ERROR
%8 = call i32 @getsockopt(i32 %5, i32 %6, i32 %7, i32* %4, i32* %3)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@SOL_PACKET = global i32 0
@SO_ERROR = global i32 0
define i32 @socket_get_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %2
store i32 0, i32* %3
%6 = load i32, i32* @SOL_PACKET
%7 = load i32, i32* @SO_ERROR
%8 = call i32 @getsockopt(i32 %0, i32 %6, i32 %7, i32* %3, i32* %2)
%9 = load i32, i32* %3
ret i32 %9
}
void glutVideoResize(int x, int y, int width, int height) {}


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

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

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

LLVM IR (-O2):
define void @glutVideoResize(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
scalar_t__ popNumber();
int /*<<< orphan*/ pushNumber(int);
void basInt() { pushNumber((int)popNumber()); }


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

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

LLVM IR (-O0):
define void @basInt() {
%1 = call i64 (...) @popNumber()
%2 = trunc i64 %1 to i32
%3 = call i32 @pushNumber(i32 %2)
ret void
}

LLVM IR (-O2):
define void @basInt() {
%1 = tail call i64 (...) @popNumber()
%2 = trunc i64 %1 to i32
%3 = tail call i32 @pushNumber(i32 %2)
ret void
}
int test(int i) {
  if (i > 3) {
    int i2 = i + 3;
    return i2;
  } else {
    int i3 = i - 5;
    return i3;
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    1125 <test+0x25>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1134 <test+0x34>
mov    -0x8(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
xor    %eax,%eax
cmp    $0x4,%edi
setge  %al
lea    (%rdi,%rax,8),%eax
add    $0xfffffffb,%eax
ret

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

LLVM IR (-O2):
define i32 @test(i32 %0) {
%2 = icmp sgt i32 %0, 3
%3 = select i1 %2, i32 3, i32 -5
%4 = add nsw i32 %3, %0
ret i32 %4
}
void fz_nullpopclip(void *user) {}


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

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

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

LLVM IR (-O2):
define void @fz_nullpopclip(i8* nocapture %0) {
ret void
}
void I2CMasterIntClear(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x0000001C))) = 0x00000001;
}


x86 assembly (clang, -O0):
<I2CMasterIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x1,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterIntClear>:
movq   $0x1,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @I2CMasterIntClear(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 28
%5 = inttoptr i64 %4 to i64*
store volatile i64 1, i64* %5
ret void
}

LLVM IR (-O2):
define void @I2CMasterIntClear(i64 %0) {
%2 = add i64 %0, 28
%3 = inttoptr i64 %2 to i64*
store volatile i64 1, i64* %3
ret void
}
char uc(char c) {
  if (c >= 'A' && c <= 'Z')
    c += 'a' - 'A';
  return c;
}


x86 assembly (clang, -O0):
<uc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     112e <uc+0x2e>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     112e <uc+0x2e>
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uc>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @uc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 32
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %10, %6, %1
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @uc(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ md5sum(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char sumres;
  md5sum(&sumres, "C:\\cygwin.7z");
  printf("%s \n", &sumres);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0xf(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <md5sum@plt>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"C:\\cygwin.7z\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @md5sum(i8* %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"C:\\cygwin.7z\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @md5sum(i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void single_step_trap(void) { panic("exception(trap): single step"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"exception(trap): single step\00"
define void @single_step_trap() {
%1 = call i32 @panic(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"exception(trap): single step\00"
define void @single_step_trap() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_2Duint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x2D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_2Duint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 45
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int right(int index) { return (2 * index) + 1; }


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

x86 assembly (clang, -O2):
<right>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @right(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
int effective_depth(int depth) {
  if (depth == 49) {
    return 99;
  } else {
    return depth * 2;
  }
}


x86 assembly (clang, -O0):
<effective_depth>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x31,-0x8(%rbp)
jne    111d <effective_depth+0x1d>
movl   $0x63,-0x4(%rbp)
jmp    1126 <effective_depth+0x26>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<effective_depth>:
lea    (%rdi,%rdi,1),%ecx
cmp    $0x31,%edi
mov    $0x63,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @effective_depth(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 49
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 99, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 2
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @effective_depth(i32 %0) {
%2 = icmp eq i32 %0, 49
%3 = shl nsw i32 %0, 1
%4 = select i1 %2, i32 99, i32 %3
ret i32 %4
}
int test_imm_F3int16_reg(short val) {
  return ((val) & (0xF3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F3int16_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, 243
%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_F3int16_reg(i16 signext %0) {
%2 = and i16 %0, 243
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ at_write(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void at_set_flat_trim(void) {
  const char cmd[] = "AT*FTRIM\r";
  at_write((int8_t *)cmd, strlen(cmd));
}


x86 assembly (clang, -O0):
<at_set_flat_trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xa(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <at_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_set_flat_trim>:
push   %rbx
sub    $0x10,%rsp
movabs $0x4d495254462a5441,%rax
52 49 4d
mov    %rax,(%rsp)
movw   $0xd,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <at_write@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.at_set_flat_trim.cmd = [10 x i8] c"AT*FTRIM\0D\00"
define void @at_set_flat_trim() {
%1 = alloca [10 x i8]
%2 = bitcast [10 x i8]* %1 to i8*
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @at_write(i32* %4, i32 %6)
ret void
}

LLVM IR (-O2):
@__const.at_set_flat_trim.cmd = [10 x i8] c"AT*FTRIM\0D\00"
define void @at_set_flat_trim() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = bitcast [10 x i8]* %1 to i32*
%4 = call i32 @strlen(i8* %2)
%5 = call i32 @at_write(i32* %3, i32 %4)
ret void
}
void gdk_window_set_geometry_hints() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_set_geometry_hints() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x93() {
  Assert_real((isbdigit(147) == 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_isbdigit.c",
              740, ("isbdigit should be 0 for 0x93"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0x93>:
push   %rax
mov    $0x93,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x2e4,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x93\00"
define void @t_isbdigit_0x93() {
%1 = call i64 @isbdigit(i32 147)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 740, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x93\00"
define void @t_isbdigit_0x93() {
%1 = tail call i64 @isbdigit(i32 147)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 740, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int __infer_nondet_int();
int /*<<< orphan*/ __require_allocated_array(char const *);
int strcmp(const char *s1, const char *s2) {
  int res;
  res = __infer_nondet_int();
  __require_allocated_array(s1);
  __require_allocated_array(s2);
  return res;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__require_allocated_array@plt>
mov    -0x10(%rbp),%rdi
call   1040 <__require_allocated_array@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <__require_allocated_array@plt>
mov    %r14,%rdi
call   1040 <__require_allocated_array@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (...) @__infer_nondet_int()
store i32 %6, i32* %5
%7 = load i8*, i8** %3
%8 = call i32 @__require_allocated_array(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @__require_allocated_array(i8* %9)
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = tail call i32 (...) @__infer_nondet_int()
%4 = tail call i32 @__require_allocated_array(i8* %0)
%5 = tail call i32 @__require_allocated_array(i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void safeFree(void *ptr) {
  free(ptr);
  ptr = NULL;
}


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

x86 assembly (clang, -O2):
<safeFree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @safeFree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
store i8* null, i8** %2
ret void
}

LLVM IR (-O2):
define void @safeFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ __gpio_get(int);
int gpio_get(int gpio) { return __gpio_get(gpio) ? 1 : 0; }


x86 assembly (clang, -O0):
<gpio_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <__gpio_get@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @gpio_get(i32 %0) {
%2 = tail call i64 @__gpio_get(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void print_byte_field(const uint8_t field[], size_t len) {
  while (len--)
    printf("%02hhx", *field++);
}


x86 assembly (clang, -O0):
<print_byte_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     115b <print_byte_field+0x4b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    1120 <print_byte_field+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_byte_field>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1145 <print_byte_field+0x35>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_byte_field+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%02hhx\00"
define void @print_byte_field(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
br label %5
5: ; preds = %9, %2
%6 = load i64, i64* %4
%7 = add i64 %6, -1
store i64 %7, i64* %4
%8 = icmp ne i64 %6, 0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i32 1
store i32* %11, i32** %3
%12 = load i32, i32* %10
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %5
14: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%02hhx\00"
define void @print_byte_field(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32* [ %8, %4 ], [ %0, %2 ]
%7 = add i64 %5, -1
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* %6
%10 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i64 %7, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void dealloc(void *val) { free(val); }


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

x86 assembly (clang, -O2):
<dealloc>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @dealloc(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int *malloc(int);
int rand();
void alloc_one_meg() {
  int number_of_bytes_of_int = (int)sizeof(int);
  int number_of_ints_for_one_megabyte = 1024 * 1024 / number_of_bytes_of_int;
  int *megabyte = malloc(sizeof(int) * number_of_ints_for_one_megabyte);
  for (int i = 0; i < number_of_ints_for_one_megabyte; i++) {
    megabyte[i] = rand();
  }
}


x86 assembly (clang, -O0):
<alloc_one_meg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x4,-0x4(%rbp)
mov    $0x100000,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1183 <alloc_one_meg+0x63>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <alloc_one_meg+0x35>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_one_meg>:
push   %r14
push   %rbx
push   %rax
mov    $0x100000,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    $0x40000,%rbx
jne    1140 <alloc_one_meg+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @alloc_one_meg() {
%1 = tail call i32* @malloc(i32 1048576)
br label %3
2: ; preds = %3
ret void
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %7, %3 ]
%5 = tail call i32 (...) @rand()
%6 = getelementptr inbounds i32, i32* %1, i64 %4
store i32 %5, i32* %6
%7 = add nuw nsw i64 %4, 1
%8 = icmp eq i64 %7, 262144
br i1 %8, label %2, label %3
}
double todegree(double val_in_radians) {
  return val_in_radians * 180.0 / 3.14159265;
}


x86 assembly (clang, -O0):
<todegree>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<todegree>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @todegree(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.800000e+02
%5 = fdiv double %4, 0x400921FB53C8D4F1
ret double %5
}

LLVM IR (-O2):
define double @todegree(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = fdiv double %2, 0x400921FB53C8D4F1
ret double %3
}
void s_push(int item, int *items, int *_size) {
  int size = *_size;
  items[size] = item;
  *_size = size + 1;
}


x86 assembly (clang, -O0):
<s_push>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_push>:
movslq (%rdx),%rax
mov    %edi,(%rsi,%rax,4)
add    $0x1,%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @s_push(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = load i32, i32* %8
store i32 %9, i32* %7
%10 = load i32, i32* %4
%11 = load i32*, i32** %5
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
store i32 %10, i32* %14
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
%17 = load i32*, i32** %6
store i32 %16, i32* %17
ret void
}

LLVM IR (-O2):
define void @s_push(i32 %0, i32* nocapture writeonly %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %1, i64 %5
store i32 %0, i32* %6
%7 = add nsw i32 %4, 1
store i32 %7, i32* %2
ret void
}
/* Variables and functions */
int omp_get_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int);
main() {
  int nthreads, tid;
#pragma omp parallel private(tid)
  {
    tid = omp_get_thread_num();
    printf("Hello World from thread = %d\n", tid);
    if (tid == 0) {
      nthreads = omp_get_num_threads();
      printf("Number of threads = %d\n", nthreads);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    117b <main+0x4b>
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
test   %ebx,%ebx
jne    1161 <main+0x31>
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Hello World from thread = %d\0A\00"
@.str.1 = [24 x i8] c"Number of threads = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @omp_get_thread_num()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = call i32 (...) @omp_get_num_threads()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %0
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [30 x i8] c"Hello World from thread = %d\0A\00"
@.str.1 = [24 x i8] c"Number of threads = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 (...) @omp_get_num_threads()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %4, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ u32;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ WriteUint32Be(int /*<<< orphan*/, void *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, float *, int);
int32_t WriteFloatBe(float value, void *out) {
  assert(out != NULL);
  uint32_t u32;
  memcpy(&u32, &value, sizeof(u32));
  return WriteUint32Be(u32, out);
}


x86 assembly (clang, -O0):
<WriteFloatBe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <WriteUint32Be@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteFloatBe>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm0,0xc(%rsp)
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
lea    0x8(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
call   1050 <WriteUint32Be@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @WriteFloatBe(float %0, i8* %1) {
%3 = alloca float
%4 = alloca i8*
%5 = alloca i32
store float %0, float* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @memcpy(i32* %5, float* %3, i32 4)
%11 = load i32, i32* %5
%12 = load i8*, i8** %4
%13 = call i32 @WriteUint32Be(i32 %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @WriteFloatBe(float %0, i8* %1) {
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
%5 = icmp ne i8* %1, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = bitcast i32* %4 to i8*
%9 = call i32 @memcpy(i32* %4, float* %3, i32 4)
%10 = load i32, i32* %4
%11 = call i32 @WriteUint32Be(i32 %10, i8* %1)
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void FILEtest(FILE *a, const FILE *b) {}


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

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

LLVM IR (-O0):
define void @FILEtest(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
ret void
}

LLVM IR (-O2):
define void @FILEtest(i32* nocapture %0, i32* nocapture %1) {
ret void
}
int gcd(int num1, int num2) {
  while (num1 != num2) {
    if (num1 > num2)
      num1 -= num2;
    else
      num2 -= num1;
  }
  return num1;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1142 <gcd+0x42>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1132 <gcd+0x32>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <gcd+0x3d>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
cmp    %esi,%edi
je     1127 <gcd+0x27>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %eax,%esi
mov    $0x0,%edx
cmovl  %esi,%edx
mov    %eax,%edi
cmovl  %ecx,%edi
sub    %edx,%eax
sub    %edi,%esi
cmp    %esi,%eax
jne    1110 <gcd+0x10>
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ %1, %2 ]
%6 = phi i32 [ %9, %4 ], [ %0, %2 ]
%7 = icmp slt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 0
%9 = sub nsw i32 %6, %8
%10 = select i1 %7, i32 0, i32 %6
%11 = sub nsw i32 %5, %10
%12 = icmp eq i32 %9, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ %0, %2 ], [ %9, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, int);
int main() {
  int i;
  char r = 0;
  for (i >= 0; i <= 256; i++) {
    r++;
    printf("%c ~ %d\n", r, i);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x9(%rbp)
cmpl   $0x100,-0x8(%rbp)
jg     115b <main+0x4b>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%edx
lea    0xebb(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1123 <main+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int Raise(int, int);
int random();
double RandZeroToOne(void) { return random() / (Raise(2, 31) - 1); }


x86 assembly (clang, -O0):
<RandZeroToOne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <random@plt>
mov    %eax,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x1f,%esi
call   1030 <Raise@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
sub    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandZeroToOne>:
push   %rbx
xor    %eax,%eax
call   1040 <random@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    $0x1f,%esi
call   1030 <Raise@plt>
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @RandZeroToOne() {
%1 = call i32 (...) @random()
%2 = call i32 @Raise(i32 2, i32 31)
%3 = sub nsw i32 %2, 1
%4 = sdiv i32 %1, %3
%5 = sitofp i32 %4 to double
ret double %5
}

LLVM IR (-O2):
define double @RandZeroToOne() {
%1 = tail call i32 (...) @random()
%2 = tail call i32 @Raise(i32 2, i32 31)
%3 = add nsw i32 %2, -1
%4 = sdiv i32 %1, %3
%5 = sitofp i32 %4 to double
ret double %5
}
void ShowTextGpuPic(void) {}


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

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

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

LLVM IR (-O2):
define void @ShowTextGpuPic() {
ret void
}
int __nthreads(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @__nthreads() {
ret i32 2
}

LLVM IR (-O2):
define i32 @__nthreads() {
ret i32 2
}
/* Variables and functions */
scalar_t__ isspace(unsigned char);
int has_spaces(const char *str) {
  char c;
  while ((c = *str++))
    if (isspace((unsigned char)c))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<has_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     115c <has_spaces+0x4c>
movzbl -0x11(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1157 <has_spaces+0x47>
movl   $0x1,-0x4(%rbp)
jmp    1163 <has_spaces+0x53>
jmp    111c <has_spaces+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_spaces>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
test   %al,%al
je     113f <has_spaces+0x2f>
add    $0x1,%rbx
movzbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1120 <has_spaces+0x10>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @has_spaces(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
br label %5
5: ; preds = %15, %1
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
store i8 %8, i8* %4
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i8, i8* %4
%12 = call i64 @isspace(i8 zeroext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %2
br label %17
15: ; preds = %10
br label %5
16: ; preds = %5
store i32 0, i32* %2
br label %17
17: ; preds = %16, %14
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @has_spaces(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = tail call i64 @isspace(i8 zeroext %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %2, label %10
10: ; preds = %2, %6
%11 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
float roundInt(float);
int main() {
  float delta = 0.03125;
  float a[3];
  a[1] = -0.375;
  float b = roundInt(a[1] / delta);
  assert(b == -12.0f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  0xed8(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xec7(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
call   1040 <roundInt@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe9d(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xed7(%rip),%xmm0
call   1040 <roundInt@plt>
cmpeqss 0xec9(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca float
%2 = alloca [3 x float]
%3 = alloca float
store float 3.125000e-02, float* %1
%4 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 1
store float -3.750000e-01, float* %4
%5 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 1
%6 = load float, float* %5
%7 = load float, float* %1
%8 = fdiv float %6, %7
%9 = call float @roundInt(float %8)
store float %9, float* %3
%10 = load float, float* %3
%11 = fcmp oeq float %10, -1.200000e+01
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call float @roundInt(float -1.200000e+01)
%2 = fcmp oeq float %1, -1.200000e+01
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}