xunge/DecIR huggingface dataset:
/* Type definitions */
struct _file_stream {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fs_read_chars(struct _file_stream *, char *,
                                 int /*<<< orphan*/, int);
int fs_read_vint(struct _file_stream *);
char *strdup(char *);
char *fs_read_string(struct _file_stream *s) {
  int length = fs_read_vint(s);
  static char chars[100];
  fs_read_chars(s, chars, 0, length);
  return strdup(chars);
}


x86 assembly (clang, -O0):
<fs_read_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fs_read_vint@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0x2efa(%rip),%rsi
xor    %edx,%edx
call   1030 <fs_read_chars@plt>
lea    0x2eec(%rip),%rdi
call   1050 <strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_read_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <fs_read_vint@plt>
lea    0x2f0d(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <fs_read_chars@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strdup@plt>

LLVM IR (-O0):
%struct._file_stream = type { i32 }
@fs_read_string.chars = internal global [100 x i8] zeroinitializer
define i8* @fs_read_string(%struct._file_stream* %0) {
%2 = alloca %struct._file_stream*
%3 = alloca i32
store %struct._file_stream* %0, %struct._file_stream** %2
%4 = load %struct._file_stream*, %struct._file_stream** %2
%5 = call i32 @fs_read_vint(%struct._file_stream* %4)
store i32 %5, i32* %3
%6 = load %struct._file_stream*, %struct._file_stream** %2
%7 = load i32, i32* %3
%8 = call i32 @fs_read_chars(%struct._file_stream* %6, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @fs_read_string.chars, i64 0, i64 0), i32 0, i32 %7)
%9 = call i8* @strdup(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @fs_read_string.chars, i64 0, i64 0))
ret i8* %9
}

LLVM IR (-O2):
%struct._file_stream = type { i32 }
@fs_read_string.chars = internal global [100 x i8] zeroinitializer
define noalias i8* @fs_read_string(%struct._file_stream* %0) {
%2 = tail call i32 @fs_read_vint(%struct._file_stream* %0)
%3 = tail call i32 @fs_read_chars(%struct._file_stream* %0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @fs_read_string.chars, i64 0, i64 0), i32 0, i32 %2)
%4 = tail call i8* @strdup(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @fs_read_string.chars, i64 0, i64 0))
ret i8* %4
}
int test_imm_37int16_mem(short *val) {
  return ((*val) & (-0x37 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_37int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffffc9,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_37int16_mem>:
movzwl (%rdi),%eax
test   $0xffc9,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_37int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -55
%7 = icmp ne i32 %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_37int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -55
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
void main(void) {
  int i;
  char str[80], str2[80];
  scanf("%[A-F]", str);
  printf("%s \n", str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    -0x60(%rbp),%rsi
lea    0xeca(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x60(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%[A-F]\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define void @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int imin(int, int);
int vect_min(int *v, int n, int min) {
  int i;
  int res = min;
  for (i = 0; i < n; i++)
    res = imin(res, v[i]);
  return res;
}


x86 assembly (clang, -O0):
<vect_min>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115f <vect_min+0x4f>
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <imin@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <vect_min+0x1f>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vect_min>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%eax
test   %esi,%esi
jle    1144 <vect_min+0x34>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbx,4),%esi
mov    %eax,%edi
call   1030 <imin@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <vect_min+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @vect_min(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = phi i32 [ %2, %5 ], [ %12, %7 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %8
%11 = load i32, i32* %10
%12 = tail call i32 @imin(i32 %9, i32 %11)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi i32 [ %2, %3 ], [ %12, %7 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ rla();
void opcode_17() { rla(); }


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

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

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

LLVM IR (-O2):
define void @opcode_17() {
%1 = tail call i32 (...) @rla()
ret void
}
int main() {
  int val = 1 + 'a';
  return (int)val;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 98
}
/* Variables and functions */
scalar_t__ isdigit(int);
int isxdigit(int c) {
  if (isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1155 <isxdigit+0x45>
cmpl   $0x61,-0x8(%rbp)
jl     1141 <isxdigit+0x31>
cmpl   $0x66,-0x8(%rbp)
jle    1155 <isxdigit+0x45>
cmpl   $0x41,-0x8(%rbp)
jl     1161 <isxdigit+0x51>
cmpl   $0x46,-0x8(%rbp)
jg     1161 <isxdigit+0x51>
movl   $0x1,-0x4(%rbp)
jmp    1168 <isxdigit+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
setne  %al
and    $0xffffffdf,%ebx
add    $0xffffffbf,%ebx
cmp    $0x6,%ebx
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isxdigit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @isdigit(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 97
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sle i32 %11, 102
br i1 %12, label %19, label %13
13: ; preds = %10, %7
%14 = load i32, i32* %3
%15 = icmp sge i32 %14, 65
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 70
br i1 %18, label %19, label %20
19: ; preds = %16, %10, %1
store i32 1, i32* %2
br label %21
20: ; preds = %16, %13
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @isxdigit(i32 %0) {
%2 = tail call i64 @isdigit(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %6, %3
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ sprintf(char *, char *, int);
char *strerror(int);
char *tempString(char *);
char *errorString(void) {
  static char buf[30];
  char *s = strerror(errno);
  if (s == 0) {
    sprintf(buf, "Error %d", errno);
    s = tempString(buf);
  }
  return s;
}


x86 assembly (clang, -O0):
<errorString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1181 <errorString+0x51>
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
lea    0x2eeb(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2ed8(%rip),%rdi
call   1030 <tempString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorString>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%edi
call   1050 <strerror@plt>
test   %rax,%rax
je     1146 <errorString+0x16>
pop    %rbx
ret
mov    (%rbx),%edx
lea    0x2f01(%rip),%rbx
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <tempString@plt>

LLVM IR (-O0):
@errorString.buf = internal global [30 x i8] zeroinitializer
@errno = global i32 0
@.str = [9 x i8] c"Error %d\00"
define i8* @errorString() {
%1 = alloca i8*
%2 = load i32, i32* @errno
%3 = call i8* @strerror(i32 %2)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i32, i32* @errno
%8 = call i32 @sprintf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @errorString.buf, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i8* @tempString(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @errorString.buf, i64 0, i64 0))
store i8* %9, i8** %1
br label %10
10: ; preds = %6, %0
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
@errorString.buf = internal global [30 x i8] zeroinitializer
@errno = global i32 0
@.str = [9 x i8] c"Error %d\00"
define i8* @errorString() {
%1 = load i32, i32* @errno
%2 = tail call i8* @strerror(i32 %1)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i32, i32* @errno
%6 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @errorString.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i8* @tempString(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @errorString.buf, i64 0, i64 0))
br label %8
8: ; preds = %4, %0
%9 = phi i8* [ %7, %4 ], [ %2, %0 ]
ret i8* %9
}
void init_f32(float *o) { *o = 0; }


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

x86 assembly (clang, -O2):
<init_f32>:
movl   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @init_f32(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
store float 0.000000e+00, float* %3
ret void
}

LLVM IR (-O2):
define void @init_f32(float* nocapture writeonly %0) {
store float 0.000000e+00, float* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sendCmd(int, char *, int, int, int, int);
void sketchLine(int fd, int x1, int y1, int x2, int y2) {
  sendCmd(fd, "line %i %i %i %i\n", x1, y1, x2, y2);
}


x86 assembly (clang, -O0):
<sketchLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xec0(%rip),%rsi
call   1030 <sendCmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sketchLine>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
lea    0xedf(%rip),%rsi
jmp    1030 <sendCmd@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"line %i %i %i %i\0A\00"
define void @sketchLine(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @sendCmd(i32 %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"line %i %i %i %i\0A\00"
define void @sketchLine(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @sendCmd(i32 %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fn();
int /*<<< orphan*/ funfn(int, int, int, int, char *);
int /*<<< orphan*/ malloc(int);
int /*<<< orphan*/ nonMalloc(int);
main() {
  malloc(10);
  nonMalloc(20);
  fn();
  funfn(1, 2, 3, 4, "hey");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    $0x14,%edi
call   1050 <nonMalloc@plt>
mov    $0x0,%al
call   1030 <fn@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
lea    0xe86(%rip),%r8
call   1060 <funfn@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    $0x14,%edi
call   1050 <nonMalloc@plt>
xor    %eax,%eax
call   1030 <fn@plt>
lea    0xe9d(%rip),%r8
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1060 <funfn@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hey\00"
define i32 @main() {
%1 = call i32 @malloc(i32 10)
%2 = call i32 @nonMalloc(i32 20)
%3 = call i32 (...) @fn()
%4 = call i32 @funfn(i32 1, i32 2, i32 3, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"hey\00"
define i32 @main() {
%1 = tail call i32 @malloc(i32 10)
%2 = tail call i32 @nonMalloc(i32 20)
%3 = tail call i32 (...) @fn()
%4 = tail call i32 @funfn(i32 1, i32 2, i32 3, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int test_imm_CCint8_mem(signed char *val) {
  return ((*val) & (-0xCC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CCint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff34,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CCint8_mem>:
movsbl (%rdi),%eax
test   $0xffffff34,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_CCint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -204
%7 = icmp ne i32 %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_CCint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -204
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
char *getbattery();
int /*<<< orphan*/ printf(char *, char *);
char *smprintf(char *, char *);
int main(int argc, char *argv[]) {
  char *battery;
  battery = getbattery();
  char *status = smprintf("%s", battery);
  printf("%s\n", status);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getbattery@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <smprintf@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <getbattery@plt>
lea    0xec1(%rip),%rdi
mov    %rax,%rsi
call   1030 <smprintf@plt>
lea    0xeb5(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @getbattery()
%4 = tail call i8* @smprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Type definitions */
struct sembuf {
  int sem_op;
  scalar_t__ sem_flg;
  scalar_t__ sem_num;
};

/* Variables and functions */
int semop(int, struct sembuf *, int);
int P(int semid) {
  struct sembuf semp[1];
  semp[0].sem_num = 0;
  semp[0].sem_op = -1;
  semp[0].sem_flg = 0;
  return (semop(semid, &semp[0], 1));
}


x86 assembly (clang, -O0):
<P>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<P>:
sub    $0x18,%rsp
movl   $0xffffffff,(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
mov    %rsp,%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sembuf = type { i32, i64, i64 }
define i32 @P(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x %struct.sembuf]
store i32 %0, i32* %2
%4 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %3, i64 0, i64 0
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i32 0, i32 2
store i64 0, i64* %5
%6 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %3, i64 0, i64 0
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %6, i32 0, i32 0
store i32 -1, i32* %7
%8 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %3, i64 0, i64 0
%9 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %8, i32 0, i32 1
store i64 0, i64* %9
%10 = load i32, i32* %2
%11 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %3, i64 0, i64 0
%12 = call i32 @semop(i32 %10, %struct.sembuf* %11, i32 1)
ret i32 %12
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i64, i64 }
define i32 @P(i32 %0) {
%2 = alloca [1 x %struct.sembuf]
%3 = bitcast [1 x %struct.sembuf]* %2 to i8*
%4 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0
%5 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0, i32 0
store i32 -1, i32* %5
%6 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0, i32 1
%7 = bitcast i64* %6 to <2 x i64>*
store <2 x i64> zeroinitializer, <2 x i64>* %7
%8 = call i32 @semop(i32 %0, %struct.sembuf* %4, i32 1)
ret i32 %8
}
void answer_resume(void) {}


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

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

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

LLVM IR (-O2):
define void @answer_resume() {
ret void
}
/* Type definitions */
struct stack_st_OPENSSL_CSTRING {
  int dummy;
};
typedef int /*<<< orphan*/ OPENSSL_STACK;

/* Variables and functions */
int /*<<< orphan*/ OPENSSL_sk_zero(int /*<<< orphan*/ *);
void sk_OPENSSL_CSTRING_zero(struct stack_st_OPENSSL_CSTRING *sk) {
  OPENSSL_sk_zero((OPENSSL_STACK *)sk);
}


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

x86 assembly (clang, -O2):
<sk_OPENSSL_CSTRING_zero>:
jmp    1030 <OPENSSL_sk_zero@plt>

LLVM IR (-O0):
%struct.stack_st_OPENSSL_CSTRING = type { i32 }
define void @sk_OPENSSL_CSTRING_zero(%struct.stack_st_OPENSSL_CSTRING* %0) {
%2 = alloca %struct.stack_st_OPENSSL_CSTRING*
store %struct.stack_st_OPENSSL_CSTRING* %0, %struct.stack_st_OPENSSL_CSTRING** %2
%3 = load %struct.stack_st_OPENSSL_CSTRING*, %struct.stack_st_OPENSSL_CSTRING** %2
%4 = bitcast %struct.stack_st_OPENSSL_CSTRING* %3 to i32*
%5 = call i32 @OPENSSL_sk_zero(i32* %4)
ret void
}

LLVM IR (-O2):
%struct.stack_st_OPENSSL_CSTRING = type { i32 }
define void @sk_OPENSSL_CSTRING_zero(%struct.stack_st_OPENSSL_CSTRING* %0) {
%2 = getelementptr %struct.stack_st_OPENSSL_CSTRING, %struct.stack_st_OPENSSL_CSTRING* %0, i64 0, i32 0
%3 = tail call i32 @OPENSSL_sk_zero(i32* %2)
ret void
}
int compare_ints(const void *a, const void *b) {
  return *((const int *)(a)) - *((const int *)(b));
}


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

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

LLVM IR (-O0):
define i32 @compare_ints(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_ints(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ Strobe_SaveConfig();
void Strobe_Sleep(void) { Strobe_SaveConfig(); }


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

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

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

LLVM IR (-O2):
define void @Strobe_Sleep() {
%1 = tail call i32 (...) @Strobe_SaveConfig()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcscpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
wchar_t *wstr_copy(wchar_t *dest, const wchar_t *src) {
  wcscpy(dest, src);
  return dest;
}


x86 assembly (clang, -O0):
<wstr_copy>:
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 <wcscpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wstr_copy>:
push   %rbx
mov    %rdi,%rbx
call   1030 <wcscpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @wstr_copy(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 = call i32 @wcscpy(i32* %5, i32* %6)
%8 = load i32*, i32** %3
ret i32* %8
}

LLVM IR (-O2):
define i32* @wstr_copy(i32* returned %0, i32* %1) {
%3 = tail call i32 @wcscpy(i32* %0, i32* %1)
ret i32* %0
}
void testOne(void) { return; }


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

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

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

LLVM IR (-O2):
define void @testOne() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int int_add(int, int);
int main() {
  int x = int_add(2000000000, 2000000000);
  assert(0 <= x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x77359400,%esi
mov    %esi,%edi
call   1040 <int_add@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x77359400,%edi
mov    $0x77359400,%esi
call   1040 <int_add@plt>
not    %eax
shr    $0x1f,%eax
mov    %eax,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @int_add(i32 2000000000, i32 2000000000)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sle i32 0, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @int_add(i32 2000000000, i32 2000000000)
%2 = xor i32 %1, -1
%3 = lshr i32 %2, 31
%4 = tail call i32 @assert(i32 %3)
ret i32 0
}
int led_gpio_register(struct gpio_led *led) { return -38; }


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

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

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

LLVM IR (-O2):
%struct.gpio_led = type opaque
define i32 @led_gpio_register(%struct.gpio_led* nocapture readnone %0) {
ret i32 -38
}
/* Variables and functions */
int close(int);
int uhi_close(int d) { return (close(d)); }


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

x86 assembly (clang, -O2):
<uhi_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @uhi_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int strcmp(char *, char *);
int name_cmp(const void *item1, const void *item2) {
  return strcmp((char *)item1, (char *)item2);
}


x86 assembly (clang, -O0):
<name_cmp>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_cmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @name_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int bpf_detach_probe(char const *, char *);
int bpf_detach_kprobe(const char *event_desc) {
  return bpf_detach_probe(event_desc, "kprobe");
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"kprobe\00"
define i32 @bpf_detach_kprobe(i8* %0) {
%2 = tail call i32 @bpf_detach_probe(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
int test_imm_99uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x99 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_99uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 657129996288
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int next_index2(int deck[], int deck_size, int curr_index, int skip) {
  int count = 0;
  while (1) {
    if (deck[curr_index] != -1 && (++count == skip + 1))
      return curr_index;
    if (++curr_index > deck_size)
      curr_index = 1;
  }
}


x86 assembly (clang, -O0):
<next_index2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1146 <next_index2+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    1146 <next_index2+0x46>
mov    -0x10(%rbp),%eax
pop    %rbp
ret
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmp    -0xc(%rbp),%eax
jle    115f <next_index2+0x5f>
movl   $0x1,-0x10(%rbp)
jmp    1118 <next_index2+0x18>

x86 assembly (clang, -O2):
<next_index2>:
mov    %edx,%eax
xor    %r9d,%r9d
mov    $0x1,%r8d
jmp    1119 <next_index2+0x19>
nopl   (%rax)
cmp    %esi,%eax
lea    0x1(%rax),%eax
cmovge %r8d,%eax
movslq %eax,%rdx
cmpl   $0xffffffff,(%rdi,%rdx,4)
je     1110 <next_index2+0x10>
cmp    %ecx,%r9d
je     112d <next_index2+0x2d>
add    $0x1,%r9d
jmp    1110 <next_index2+0x10>
ret

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

LLVM IR (-O2):
define i32 @next_index2(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
br label %5
5: ; preds = %16, %4
%6 = phi i32 [ %2, %4 ], [ %20, %16 ]
%7 = phi i32 [ 0, %4 ], [ %17, %16 ]
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, -1
br i1 %11, label %16, label %12
12: ; preds = %5
%13 = add nsw i32 %7, 1
%14 = icmp eq i32 %7, %3
br i1 %14, label %15, label %16
15: ; preds = %12
ret i32 %6
16: ; preds = %12, %5
%17 = phi i32 [ %13, %12 ], [ %7, %5 ]
%18 = add nsw i32 %6, 1
%19 = icmp slt i32 %6, %1
%20 = select i1 %19, i32 %18, i32 1
br label %5
}
int test_imm_4Buint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x4B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Buint64_midword_mem>:
testb  $0x4b,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_4Buint64_midword_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, 16
%6 = and i64 %5, 75
%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_4Buint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4915200
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void __attribute__((weak)) otg_hs_ep1_in_isr() { debug_handler(__FUNCTION__); }


x86 assembly (clang, -O0):
<otg_hs_ep1_in_isr>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <debug_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<otg_hs_ep1_in_isr>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <debug_handler@plt>

LLVM IR (-O0):
@__FUNCTION__.otg_hs_ep1_in_isr = [18 x i8] c"otg_hs_ep1_in_isr\00"
define weak void @otg_hs_ep1_in_isr() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.otg_hs_ep1_in_isr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__FUNCTION__.otg_hs_ep1_in_isr = [18 x i8] c"otg_hs_ep1_in_isr\00"
define weak void @otg_hs_ep1_in_isr() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @debug_handler to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__FUNCTION__.otg_hs_ep1_in_isr, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int emptyRequest(char *buff) {
  if (strcmp(buff, "\r\n") != 0 && strcmp(buff, "\n") != 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<emptyRequest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     115c <emptyRequest+0x4c>
mov    -0x10(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     115c <emptyRequest+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <emptyRequest+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emptyRequest>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1143 <emptyRequest+0x33>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     1143 <emptyRequest+0x33>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @emptyRequest(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4, %1
br label %8
8: ; preds = %4, %7
%9 = phi i32 [ 0, %7 ], [ -1, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     116f <main+0x4f>
mov    -0x8(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1163 <main+0x43>
xor    %ebx,%ebx
lea    0xebe(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    0x4(%rsp),%ebx
jl     1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ 1, %0 ]
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = add nuw nsw i32 %7, 1
%10 = load i32, i32* %1
%11 = icmp slt i32 %7, %10
br i1 %11, label %6, label %12
12: ; preds = %6, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void ITEMOUT(void) { fputs("@item ", stdout); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"@item \00"
@stdout = global i32 0
define void @ITEMOUT() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ itoa(int, char *);
int /*<<< orphan*/ report(int, int /*<<< orphan*/);
void dreport(int row, int value) {
  static char buf[7];
  report(row, itoa(value, buf));
}


x86 assembly (clang, -O0):
<dreport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    0x2ef3(%rip),%rsi
call   1040 <itoa@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1030 <report@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dreport>:
push   %rbx
mov    %esi,%eax
mov    %edi,%ebx
lea    0x2f05(%rip),%rsi
mov    %eax,%edi
call   1040 <itoa@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <report@plt>

LLVM IR (-O0):
@dreport.buf = internal global [7 x i8] zeroinitializer
define void @dreport(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 = call i32 @itoa(i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @dreport.buf, i64 0, i64 0))
%8 = call i32 @report(i32 %5, i32 %7)
ret void
}

LLVM IR (-O2):
@dreport.buf = internal global [7 x i8] zeroinitializer
define void @dreport(i32 %0, i32 %1) {
%3 = tail call i32 @itoa(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @dreport.buf, i64 0, i64 0))
%4 = tail call i32 @report(i32 %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Sleep(int);
void lisys_usleep(int usecs) { Sleep(usecs / 1000); }


x86 assembly (clang, -O0):
<lisys_usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <Sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lisys_usleep>:
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x26,%rdi
add    %eax,%edi
jmp    1030 <Sleep@plt>

LLVM IR (-O0):
define void @lisys_usleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 1000
%5 = call i32 @Sleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @lisys_usleep(i32 %0) {
%2 = sdiv i32 %0, 1000
%3 = tail call i32 @Sleep(i32 %2)
ret void
}
void foo587(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo587(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ bool_t;

/* Variables and functions */
int /*<<< orphan*/ TRUE;
bool_t xdr_void(void) { return (TRUE); }


x86 assembly (clang, -O0):
<xdr_void>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_void>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@TRUE = global i32 0
define i32 @xdr_void() {
%1 = load i32, i32* @TRUE
ret i32 %1
}

LLVM IR (-O2):
@TRUE = global i32 0
define i32 @xdr_void() {
%1 = load i32, i32* @TRUE
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ va_arg_int(int *, int);
void call_va_arg_int_Bad() {
  int a[10];
  va_arg_int(a, 10);
}


x86 assembly (clang, -O0):
<call_va_arg_int_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <va_arg_int@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_va_arg_int_Bad>:
sub    $0x28,%rsp
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <va_arg_int@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @call_va_arg_int_Bad() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%3 = call i32 @va_arg_int(i32* %2, i32 10)
ret void
}

LLVM IR (-O2):
define void @call_va_arg_int_Bad() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @va_arg_int(i32* %3, i32 10)
ret void
}
void foo_1_2_2_2_1_2_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_2_1_2_1_2_2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int *i) { bar(*i); }


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

x86 assembly (clang, -O2):
<foo>:
mov    (%rdi),%edi
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @foo(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @bar(i32 %2)
ret void
}
INSTR(OCBI) { NEXT_INSTR(); }


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

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

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

LLVM IR (-O2):
define i32 @INSTR(i32 %0) {
%2 = tail call i32 (...) @NEXT_INSTR()
ret i32 undef
}
void *make_sym_readable(void *ptr) { return ptr; }


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

x86 assembly (clang, -O2):
<make_sym_readable>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @make_sym_readable(i8* readnone returned %0) {
ret i8* %0
}