xunge/DecIR huggingface dataset:
/* Variables and functions */
int open_port();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ set_speed_and_parity(int, int);
int serialport() {
  int fd;
  if ((fd = open_port()) < 0) {
    perror("open_port error");
    return 0;
  }
  set_speed_and_parity(fd, 115200);
  return (fd);
}


x86 assembly (clang, -O0):
<serialport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <open_port@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    1163 <serialport+0x33>
lea    0xeae(%rip),%rdi
call   1040 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    1176 <serialport+0x46>
mov    -0x8(%rbp),%edi
mov    $0x1c200,%esi
call   1030 <set_speed_and_parity@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialport>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <open_port@plt>
test   %eax,%eax
js     1159 <serialport+0x29>
mov    %eax,%ebp
mov    %eax,%edi
mov    $0x1c200,%esi
call   1030 <set_speed_and_parity@plt>
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
jmp    1150 <serialport+0x20>

LLVM IR (-O0):
@.str = [16 x i8] c"open_port error\00"
define i32 @serialport() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @open_port()
store i32 %3, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %11
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 @set_speed_and_parity(i32 %8, i32 115200)
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %11
11: ; preds = %7, %5
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [16 x i8] c"open_port error\00"
define i32 @serialport() {
%1 = tail call i32 (...) @open_port()
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 @set_speed_and_parity(i32 %1, i32 115200)
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ 0, %3 ], [ %1, %5 ]
ret i32 %8
}
double _fmax(double a, double b) { return (a > b ? a : b); }


x86 assembly (clang, -O0):
<_fmax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    112d <_fmax+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <_fmax+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fmax>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @_fmax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ogt double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @_fmax(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int test12(int a) { return a <= 0 ? 0x7FFFFFFF : 0x80000000; }


x86 assembly (clang, -O0):
<test12>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x80000000,%eax
mov    $0x7fffffff,%ecx
cmp    $0x0,%edx
cmovle %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test12>:
xor    %ecx,%ecx
test   %edi,%edi
setle  %cl
mov    $0x80000000,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test12(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 2147483647, i32 -2147483648
ret i32 %6
}

LLVM IR (-O2):
define i32 @test12(i32 %0) {
%2 = icmp slt i32 %0, 1
%3 = select i1 %2, i32 2147483647, i32 -2147483648
ret i32 %3
}
int is_end_of_text(int position_in_string, int str_len) {
  return str_len == position_in_string;
}


x86 assembly (clang, -O0):
<is_end_of_text>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_end_of_text>:
xor    %eax,%eax
cmp    %edi,%esi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_end_of_text(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_end_of_text(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(unsigned char *, char *, unsigned int);
const char *kb_keyname(unsigned char *key, int n) {
  unsigned c;
  if (n < 2)
    return NULL;
  c = key[0];
  c |= key[1] << 8;
  sprintf(key, "%X", c);
  return key;
}


x86 assembly (clang, -O0):
<kb_keyname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1136 <kb_keyname+0x26>
movq   $0x0,-0x8(%rbp)
jmp    116c <kb_keyname+0x5c>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xea1(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kb_keyname>:
push   %rbx
cmp    $0x2,%esi
jge    111a <kb_keyname+0xa>
xor    %ebx,%ebx
jmp    112c <kb_keyname+0x1c>
mov    %rdi,%rbx
movzwl (%rdi),%edx
lea    0xed9(%rip),%rsi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%X\00"
define i8* @kb_keyname(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* null, i8** %3
br label %26
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
store i32 %14, i32* %6
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i32, i32* %6
%21 = or i32 %20, %19
store i32 %21, i32* %6
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i8*, i8** %4
store i8* %25, i8** %3
br label %26
26: ; preds = %10, %9
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"%X\00"
define i8* @kb_keyname(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = zext i8 %5 to i32
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl nuw nsw i32 %9, 8
%11 = or i32 %10, %6
%12 = tail call i32 @sprintf(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %2, %4
%14 = phi i8* [ %0, %4 ], [ null, %2 ]
ret i8* %14
}
void collisions_search(void) {}


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

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

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

LLVM IR (-O2):
define void @collisions_search() {
ret void
}
void foo541(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo541(i32 %0) {
ret void
}
/* Variables and functions */
void vsnprintf(void) {}


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

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

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

LLVM IR (-O2):
define void @vsnprintf() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clearGraph(int **);
int /*<<< orphan*/ dijkstra(int **);
int /*<<< orphan*/ inputWGraph(int **);
int /*<<< orphan*/ printGraphMatrix(int **);
int /*<<< orphan*/ system(char *);
int main() {
  system("COLOR B");
  int adjacencyMatrix[7][7];
  clearGraph(adjacencyMatrix);
  inputWGraph(adjacencyMatrix);
  printGraphMatrix(adjacencyMatrix);
  dijkstra(adjacencyMatrix);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <system@plt>
lea    -0xd0(%rbp),%rdi
call   1070 <clearGraph@plt>
lea    -0xd0(%rbp),%rdi
call   1050 <inputWGraph@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <printGraphMatrix@plt>
lea    -0xd0(%rbp),%rdi
call   1060 <dijkstra@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
lea    0xea1(%rip),%rdi
call   1040 <system@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <clearGraph@plt>
mov    %rbx,%rdi
call   1050 <inputWGraph@plt>
mov    %rbx,%rdi
call   1030 <printGraphMatrix@plt>
mov    %rbx,%rdi
call   1060 <dijkstra@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"COLOR B\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x [7 x i32]]
store i32 0, i32* %1
%3 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %2, i64 0, i64 0
%5 = bitcast [7 x i32]* %4 to i32**
%6 = call i32 @clearGraph(i32** %5)
%7 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %2, i64 0, i64 0
%8 = bitcast [7 x i32]* %7 to i32**
%9 = call i32 @inputWGraph(i32** %8)
%10 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %2, i64 0, i64 0
%11 = bitcast [7 x i32]* %10 to i32**
%12 = call i32 @printGraphMatrix(i32** %11)
%13 = getelementptr inbounds [7 x [7 x i32]], [7 x [7 x i32]]* %2, i64 0, i64 0
%14 = bitcast [7 x i32]* %13 to i32**
%15 = call i32 @dijkstra(i32** %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"COLOR B\00"
define i32 @main() {
%1 = alloca [7 x [7 x i32]]
%2 = tail call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = bitcast [7 x [7 x i32]]* %1 to i8*
%4 = bitcast [7 x [7 x i32]]* %1 to i32**
%5 = call i32 @clearGraph(i32** %4)
%6 = call i32 @inputWGraph(i32** %4)
%7 = call i32 @printGraphMatrix(i32** %4)
%8 = call i32 @dijkstra(i32** %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int AMCSocketClose(int socketId) {
  close(socketId);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @AMCSocketClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strShift(char *);
int main(void) { printf("%s", strShift("anaz")); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"anaz\00"
define i32 @main() {
%1 = call i8* @strShift(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"anaz\00"
define i32 @main() {
%1 = tail call i8* @strShift(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
char *setlocale(int category, const char *locale) { return ""; }


x86 assembly (clang, -O0):
<setlocale>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeee(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @setlocale(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @setlocale(i32 %0, i8* nocapture readnone %1) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
unsigned short csum_fold(int /*<<< orphan*/);
int /*<<< orphan*/ csum_tcpudp_nofold(unsigned long, unsigned long,
                                      unsigned short, unsigned short,
                                      unsigned int);
extern unsigned short int
csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
                  unsigned short proto, unsigned int sum) {
  return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
}


x86 assembly (clang, -O0):
<csum_tcpudp_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %cx,-0x12(%rbp)
mov    %ax,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x12(%rbp),%cx
mov    -0x14(%rbp),%ax
mov    -0x18(%rbp),%r8d
movzwl %cx,%edx
movzwl %ax,%ecx
call   1040 <csum_tcpudp_nofold@plt>
mov    %eax,%edi
call   1030 <csum_fold@plt>
movzwl %ax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_tcpudp_magic>:
push   %rax
call   1040 <csum_tcpudp_nofold@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <csum_fold@plt>

LLVM IR (-O0):
define zeroext i16 @csum_tcpudp_magic(i64 %0, i64 %1, i16 zeroext %2, i16 zeroext %3, i32 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
store i64 %0, i64* %6
store i64 %1, i64* %7
store i16 %2, i16* %8
store i16 %3, i16* %9
store i32 %4, i32* %10
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i16, i16* %8
%14 = load i16, i16* %9
%15 = load i32, i32* %10
%16 = call i32 @csum_tcpudp_nofold(i64 %11, i64 %12, i16 zeroext %13, i16 zeroext %14, i32 %15)
%17 = call zeroext i16 @csum_fold(i32 %16)
ret i16 %17
}

LLVM IR (-O2):
define zeroext i16 @csum_tcpudp_magic(i64 %0, i64 %1, i16 zeroext %2, i16 zeroext %3, i32 %4) {
%6 = tail call i32 @csum_tcpudp_nofold(i64 %0, i64 %1, i16 zeroext %2, i16 zeroext %3, i32 %4)
%7 = tail call zeroext i16 @csum_fold(i32 %6)
ret i16 %7
}
int bufbsdsock_flush(void *data) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @bufbsdsock_flush(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
void *gzdopen(int, char *);
void *gz_file_handler_dopen(int fileno) { return gzdopen(fileno, "w1"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"w1\00"
define i8* @gz_file_handler_dopen(i32 %0) {
%2 = tail call i8* @gzdopen(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
void f1(void) {
  struct S {
    int a;
    int b[2];
    _Atomic int *c;
  };
  _Atomic int a = 0, b[2];
  _Atomic int d[3];
  _Atomic struct S c = (struct S){3, {4, 5}, d};
  int *_Atomic p;
  _Atomic int *q;
  int e[3] = {1, 2, 3};
  b[0] = 1;
  b[1] = 2;
  d[0] = 6;
  d[1] = 7;
  d[2] = 8;
  p = e;
#pragma omp target map(tofrom : a)
  ;
#pragma omp target map(to : b)
  ;
#pragma omp target map(from : b [1:1])
  ;
#pragma omp target map(to : c.a)
  ;
#pragma omp target map(to : c.b[1])
  ;
#pragma omp target data map(c)
  {
#pragma omp target update to(c.a)
#pragma omp target update from(c.b[1])
#pragma omp target update to(c)
  }
#pragma omp target map(to : c.c [0:])
  ;
#pragma omp target map(to : p [1:2])
  ;
#pragma omp target map(to : q [1:2])
  ;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x30(%rbp)
movl   $0x4,-0x2c(%rbp)
movl   $0x5,-0x28(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0xeda(%rip),%eax
mov    %eax,-0x48(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    $0x1,%eax
xchg   %eax,-0xc(%rbp)
mov    $0x2,%eax
xchg   %eax,-0x8(%rbp)
mov    $0x6,%eax
xchg   %eax,-0x18(%rbp)
mov    $0x7,%eax
xchg   %eax,-0x14(%rbp)
mov    $0x8,%eax
xchg   %eax,-0x10(%rbp)
lea    -0x50(%rbp),%rax
xchg   %rax,-0x38(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.S = type { i32, [2 x i32], i32* }
@__const.f1.e = [3 x i32] [i32 1, i32 2, i32 3]
define void @f1() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [3 x i32]
%4 = alloca %struct.S
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [3 x i32]
store i32 0, i32* %1
%8 = getelementptr inbounds %struct.S, %struct.S* %4, i32 0, i32 0
store i32 3, i32* %8
%9 = getelementptr inbounds %struct.S, %struct.S* %4, i32 0, i32 1
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 4, i32* %10
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 5, i32* %11
%12 = getelementptr inbounds %struct.S, %struct.S* %4, i32 0, i32 2
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32* %13, i32** %12
%14 = bitcast [3 x i32]* %7 to i8*
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store atomic i32 1, i32* %15 seq_cst
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store atomic i32 2, i32* %16 seq_cst
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store atomic i32 6, i32* %17 seq_cst
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
store atomic i32 7, i32* %18 seq_cst
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
store atomic i32 8, i32* %19 seq_cst
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%21 = ptrtoint i32* %20 to i64
%22 = bitcast i32** %5 to i64*
store atomic i64 %21, i64* %22 seq_cst
ret void
}

LLVM IR (-O2):
define void @f1() {
ret void
}
/* Type definitions */
typedef char *off_t;

/* Variables and functions */
off_t lseek(int fd, off_t offset, int whence) {
  do {
    if (!(0))
      asm volatile(".byte 0xd6" : : "a"(1));
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<lseek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x1,%eax
(bad)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lseek>:
mov    $0x1,%eax
(bad)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @lseek(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %3
br label %8
8: ; preds = %7
ret i8* null
}

LLVM IR (-O2):
define i8* @lseek(i32 %0, i8* nocapture readnone %1, i32 %2) {
tail call void asm sideeffect ".byte 0xd6", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 1)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ shutdown(int, int);
void skclose(int *sd) {
  if (sd) {
    close(*sd);
    shutdown(*sd, 2);
    free(sd);
  }
}


x86 assembly (clang, -O0):
<skclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116b <skclose+0x3b>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <close@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0x2,%esi
call   1040 <shutdown@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skclose>:
test   %rdi,%rdi
je     1155 <skclose+0x25>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1050 <close@plt>
mov    (%rbx),%edi
mov    $0x2,%esi
call   1040 <shutdown@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @skclose(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = call i32 @close(i32 %7)
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = call i32 @shutdown(i32 %10, i32 2)
%12 = load i32*, i32** %2
%13 = call i32 @free(i32* %12)
br label %14
14: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @skclose(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i32, i32* %0
%5 = tail call i32 @close(i32 %4)
%6 = load i32, i32* %0
%7 = tail call i32 @shutdown(i32 %6, i32 2)
%8 = tail call i32 @free(i32* %0)
br label %9
9: ; preds = %3, %1
ret void
}
int LZ4_versionNumber(void) { return (1 * 100 * 100 + 8 * 100 + 0); }


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

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

LLVM IR (-O0):
define i32 @LZ4_versionNumber() {
ret i32 10800
}

LLVM IR (-O2):
define i32 @LZ4_versionNumber() {
ret i32 10800
}
/* Variables and functions */
int /*<<< orphan*/ clearGPIO(int, int);
void LEDOff() {
  clearGPIO(2, 10);
  clearGPIO(2, 11);
  clearGPIO(2, 12);
}


x86 assembly (clang, -O0):
<LEDOff>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
mov    $0xa,%esi
call   1030 <clearGPIO@plt>
mov    $0x2,%edi
mov    $0xb,%esi
call   1030 <clearGPIO@plt>
mov    $0x2,%edi
mov    $0xc,%esi
call   1030 <clearGPIO@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LEDOff>:
push   %rax
mov    $0x2,%edi
mov    $0xa,%esi
call   1030 <clearGPIO@plt>
mov    $0x2,%edi
mov    $0xb,%esi
call   1030 <clearGPIO@plt>
mov    $0x2,%edi
mov    $0xc,%esi
pop    %rax
jmp    1030 <clearGPIO@plt>

LLVM IR (-O0):
define void @LEDOff() {
%1 = call i32 @clearGPIO(i32 2, i32 10)
%2 = call i32 @clearGPIO(i32 2, i32 11)
%3 = call i32 @clearGPIO(i32 2, i32 12)
ret void
}

LLVM IR (-O2):
define void @LEDOff() {
%1 = tail call i32 @clearGPIO(i32 2, i32 10)
%2 = tail call i32 @clearGPIO(i32 2, i32 11)
%3 = tail call i32 @clearGPIO(i32 2, i32 12)
ret void
}
/* Variables and functions */
const char *getprogname(void) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @getprogname() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @getprogname() {
ret i8* null
}
long f(void) { return 'f'; }


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

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

LLVM IR (-O0):
define i64 @f() {
ret i64 102
}

LLVM IR (-O2):
define i64 @f() {
ret i64 102
}
int getSecretScore() { return 100; }


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

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

LLVM IR (-O0):
define i32 @getSecretScore() {
ret i32 100
}

LLVM IR (-O2):
define i32 @getSecretScore() {
ret i32 100
}
/* Variables and functions */
int worst_fit_memory_init(size_t size) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @worst_fit_memory_init(i64 %0) {
ret i32 0
}
int cmp(const void *a, const void *b) { return *(int *)b - *(int *)a; }


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

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

LLVM IR (-O0):
define i32 @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** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%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 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ cgpop2();
int /*<<< orphan*/ cgshl();
int /*<<< orphan*/ cgswap();
int /*<<< orphan*/ gentext();
void genshl(int swap) {
  gentext();
  cgpop2();
  if (swap)
    cgswap();
  cgshl();
}


x86 assembly (clang, -O0):
<genshl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <gentext@plt>
mov    $0x0,%al
call   1040 <cgpop2@plt>
cmpl   $0x0,-0x4(%rbp)
je     116a <genshl+0x2a>
mov    $0x0,%al
call   1030 <cgswap@plt>
mov    $0x0,%al
call   1060 <cgshl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genshl>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <gentext@plt>
xor    %eax,%eax
call   1040 <cgpop2@plt>
test   %ebx,%ebx
je     115c <genshl+0x1c>
xor    %eax,%eax
call   1030 <cgswap@plt>
xor    %eax,%eax
pop    %rbx
jmp    1060 <cgshl@plt>

LLVM IR (-O0):
define void @genshl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @gentext()
%4 = call i32 (...) @cgpop2()
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @cgswap()
br label %9
9: ; preds = %7, %1
%10 = call i32 (...) @cgshl()
ret void
}

LLVM IR (-O2):
define void @genshl(i32 %0) {
%2 = tail call i32 (...) @gentext()
%3 = tail call i32 (...) @cgpop2()
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @cgswap()
br label %7
7: ; preds = %5, %1
%8 = tail call i32 (...) @cgshl()
ret void
}
int getbits(unsigned x, int p, int n) {
  return (x >> (p + 1 - n)) & ~(~0 << n);
}


x86 assembly (clang, -O0):
<getbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getbits>:
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shr    %cl,%edi
mov    $0xffffffff,%eax
mov    %edx,%ecx
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @getbits(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %8, 1
%10 = load i32, i32* %6
%11 = sub nsw i32 %9, %10
%12 = lshr i32 %7, %11
%13 = load i32, i32* %6
%14 = shl i32 -1, %13
%15 = xor i32 %14, -1
%16 = and i32 %12, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @getbits(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, 1
%5 = sub i32 %4, %2
%6 = lshr i32 %0, %5
%7 = shl nsw i32 -1, %2
%8 = xor i32 %7, -1
%9 = and i32 %6, %8
ret i32 %9
}
/* Variables and functions */
int func(int, int);
int main() {
  int b = 4;
  bool l = func(true, false);
  if (l)
    return b;
  else
    return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <func@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114a <main+0x3a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <main+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <func@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
shl    $0x2,%ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32 1, i32 0)
%2 = icmp eq i32 %1, 0
%3 = select i1 %2, i32 0, i32 4
ret i32 %3
}
int test2(int a, int b) {
  int lt = a < b;
  int eq = a == b;
  return (lt || eq);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jne    1145 <test2+0x45>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
xor    %eax,%eax
cmp    %esi,%edi
setle  %al
ret

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

LLVM IR (-O2):
define i32 @test2(i32 %0, i32 %1) {
%3 = icmp sle i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned int read16(unsigned int);
unsigned int fetch16(unsigned int addr) { return (read16(addr)); }


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

x86 assembly (clang, -O2):
<fetch16>:
jmp    1030 <read16@plt>

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

LLVM IR (-O2):
define i32 @fetch16(i32 %0) {
%2 = tail call i32 @read16(i32 %0)
ret i32 %2
}
/* Variables and functions */
int htoi2(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = htoi2("0x107");
  printf("%d\n", i);
}


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"0x107\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @htoi2(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
sub(i) { return i - 1; }


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

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

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

LLVM IR (-O2):
define i32 @sub(i32 %0) {
%2 = add nsw i32 %0, -1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushcharacterarray(char *x, int n) {
  pushNarray((char *)x, (unsigned int)n);
}


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

x86 assembly (clang, -O2):
<pushcharacterarray>:
jmp    1030 <pushNarray@plt>

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

LLVM IR (-O2):
define void @pushcharacterarray(i8* %0, i32 %1) {
%3 = tail call i32 @pushNarray(i8* %0, i32 %1)
ret void
}
void finished_logging(const char *filename, int line) {}


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

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

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

LLVM IR (-O2):
define void @finished_logging(i8* nocapture %0, i32 %1) {
ret void
}
double jac_chain_nm10_sq(double x) { return x * x; }


x86 assembly (clang, -O0):
<jac_chain_nm10_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_chain_nm10_sq>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @jac_chain_nm10_sq(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @jac_chain_nm10_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
char *strerror(num)
int num;
{
  extern const int sys_nerr;
  extern const char *sys_errlist[];
  static const char ebuf[] = "Unknown error";
  unsigned int errnum;
  errnum = num;
  if (errnum < (unsigned int)sys_nerr)
    return ((char *)sys_errlist[errnum]);
  return ((char *)ebuf);
}


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2ed1(%rip),%rcx
cmp    (%rcx),%eax
jae    1138 <strerror+0x38>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
mov    0x2ecd(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1143 <strerror+0x43>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
mov    0x2ee1(%rip),%rax
cmp    %edi,(%rax)
jbe    1119 <strerror+0x19>
mov    %edi,%eax
mov    0x2ee4(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret
lea    0xee0(%rip),%rax
ret

LLVM IR (-O0):
@strerror.ebuf = internal constant [14 x i8] c"Unknown error\00"
@sys_nerr = external constant i32
@sys_errlist = external global [0 x i8*]
define i8* @strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* @sys_nerr
%8 = icmp ult i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds [0 x i8*], [0 x i8*]* @sys_errlist, i64 0, i64 %11
%13 = load i8*, i8** %12
store i8* %13, i8** %2
br label %15
14: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @strerror.ebuf, i64 0, i64 0), i8** %2
br label %15
15: ; preds = %14, %9
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@strerror.ebuf = internal constant [14 x i8] c"Unknown error\00"
@sys_nerr = external constant i32
@sys_errlist = external global [0 x i8*]
define i8* @strerror(i32 %0) {
%2 = load i32, i32* @sys_nerr
%3 = icmp ugt i32 %2, %0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = zext i32 %0 to i64
%6 = getelementptr inbounds [0 x i8*], [0 x i8*]* @sys_errlist, i64 0, i64 %5
%7 = load i8*, i8** %6
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @strerror.ebuf, i64 0, i64 0), %1 ]
ret i8* %9
}
char *strchr(char *str, int ch) {
  for (; *str; str++)
    if (*str == (char)ch)
      return str;
  return ((void *)0);
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1150 <strchr+0x50>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    113a <strchr+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <strchr+0x58>
jmp    113f <strchr+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr+0x23>
mov    %rdi,%rax
movsbl %sil,%edx
nopl   (%rax)
movsbl %cl,%ecx
cmp    %ecx,%edx
je     1125 <strchr+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %13
%9 = phi i8 [ %3, %5 ], [ %15, %13 ]
%10 = phi i8* [ %0, %5 ], [ %14, %13 ]
%11 = sext i8 %9 to i32
%12 = icmp eq i32 %7, %11
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8, %13, %2
%18 = phi i8* [ null, %2 ], [ null, %13 ], [ %10, %8 ]
ret i8* %18
}
/* Variables and functions */
int /*<<< orphan*/ run(int);
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i <= 100; ++i) {
    run(i);
  }
  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)
movl   $0x1,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     114d <main+0x3d>
mov    -0x14(%rbp),%edi
call   1030 <run@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <run@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 1, %2 ], [ %6, %3 ]
%5 = tail call i32 @run(i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 101
br i1 %7, label %8, label %3
8: ; preds = %3
ret i32 0
}
/* Variables and functions */
int strlen(char *);
int StringLastChar(char *s) {
  if (*s)
    return (s[strlen(s) - 1]);
  else
    return ('\0');
}


x86 assembly (clang, -O0):
<StringLastChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <StringLastChar+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <StringLastChar+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringLastChar>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1127 <StringLastChar+0x17>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbx,1),%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @StringLastChar(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
br label %11
11: ; preds = %1, %4
%12 = phi i32 [ %10, %4 ], [ 0, %1 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ __itt_thread_set_name_init_3_0(char const *);
int __itt_thr_name_set_init_3_0(const char *name, int namelen) {
  namelen = namelen;
  __itt_thread_set_name_init_3_0(name);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @__itt_thr_name_set_init_3_0(i8* %0, i32 %1) {
%3 = tail call i32 @__itt_thread_set_name_init_3_0(i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void safe_free(void *mem) {
  if (mem != NULL)
    free(mem);
}


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

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

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

LLVM IR (-O2):
define void @safe_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void threads_init() {}


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

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

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

LLVM IR (-O2):
define void @threads_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char **);
int FreeEnvStrs_(char *envp[]) {
  free(envp);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @FreeEnvStrs_(i8** nocapture %0) {
%2 = tail call i32 @free(i8** %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __poet_fail();
int nondet(int, int);
int main(void) {
  int x = nondet(1, 10);
  if (x < 1)
    __poet_fail();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0xa,%esi
call   1040 <nondet@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    1152 <main+0x32>
mov    $0x0,%al
call   1030 <__poet_fail@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0xa,%esi
call   1040 <nondet@plt>
test   %eax,%eax
jg     113b <main+0x1b>
xor    %eax,%eax
call   1030 <__poet_fail@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 @nondet(i32 1, i32 10)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @__poet_fail()
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @nondet(i32 1, i32 10)
%2 = icmp slt i32 %1, 1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @__poet_fail()
br label %5
5: ; preds = %3, %0
ret i32 0
}