xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ WriteSerial(int /*<<< orphan*/);
void WriteSerialBuf(unsigned char *buf, unsigned char len) {
  while (len--)
    WriteSerial(*buf++);
}


x86 assembly (clang, -O0):
<WriteSerialBuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    %al,%cl
add    $0xff,%cl
mov    %cl,-0x9(%rbp)
cmp    $0x0,%al
je     1151 <WriteSerialBuf+0x41>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edi
call   1030 <WriteSerial@plt>
jmp    1122 <WriteSerialBuf+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteSerialBuf>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1143 <WriteSerialBuf+0x33>
mov    %rdi,%r14
movzbl %sil,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%edi
call   1030 <WriteSerial@plt>
add    $0x1,%rbx
cmp    %bl,%r15b
jne    1130 <WriteSerialBuf+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @WriteSerialBuf(i8* nocapture %0, i8 zeroext %1) {
%3 = icmp eq i8 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i8 [ %7, %4 ], [ %1, %2 ]
%6 = phi i8* [ %8, %4 ], [ %0, %2 ]
%7 = add i8 %5, -1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = tail call i32 @WriteSerial(i32 %10)
%12 = icmp eq i8 %7, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
int test_imm_BEint32_reg(int val) { return ((val) & (0xBE << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_BEint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xbe,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_BEint32_reg(i32 %0) {
%2 = and i32 %0, 190
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int foo() { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ UpnpResponse_MediaRenderer_AVTransport_Previous(void *);
int /*<<< orphan*/ printf(char *, unsigned int);
void UpnpMediaRenderer_AVTransport_Previous(void *upnptoken,
                                            unsigned int InstanceID) {
  printf("Invoke: UpnpMediaRenderer_AVTransport_Previous(%u);\r\n", InstanceID);
  UpnpResponse_MediaRenderer_AVTransport_Previous(upnptoken);
}


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

x86 assembly (clang, -O2):
<UpnpMediaRenderer_AVTransport_Previous>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <UpnpResponse_MediaRenderer_AVTransport_Previous@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Invoke: UpnpMediaRenderer_AVTransport_Previous(%u);\0D\0A\00"
define void @UpnpMediaRenderer_AVTransport_Previous(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
%6 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @UpnpResponse_MediaRenderer_AVTransport_Previous(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Invoke: UpnpMediaRenderer_AVTransport_Previous(%u);\0D\0A\00"
define void @UpnpMediaRenderer_AVTransport_Previous(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @UpnpResponse_MediaRenderer_AVTransport_Previous(i8* %0)
ret void
}
void RTStrCalcLatin1LenEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrCalcLatin1LenEx() {
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
double timevaltod(struct timeval *t) {
  return t->tv_sec + t->tv_usec / 1000000.0;
}


x86 assembly (clang, -O0):
<timevaltod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xedf(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timevaltod>:
movsd  0x8(%rdi),%xmm0
divsd  0xef3(%rip),%xmm0
addsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @timevaltod(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%5 = load double, double* %4
%6 = load %struct.timeval*, %struct.timeval** %2
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%8 = load double, double* %7
%9 = fdiv double %8, 1.000000e+06
%10 = fadd double %5, %9
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @timevaltod(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load double, double* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%5 = load double, double* %4
%6 = fdiv double %5, 1.000000e+06
%7 = fadd double %3, %6
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ DS18B20_reset();
int /*<<< orphan*/ DS18B20_write_byte(int);
void adjust_res(unsigned char res) {
  DS18B20_reset();
  DS18B20_write_byte(0xcc);
  DS18B20_write_byte(0x4e);
  DS18B20_write_byte(0x02);
  DS18B20_write_byte(0x01);
  DS18B20_write_byte(res);
  DS18B20_reset();
  DS18B20_write_byte(0xcc);
  DS18B20_write_byte(0x48);
}


x86 assembly (clang, -O0):
<adjust_res>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1040 <DS18B20_reset@plt>
mov    $0xcc,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x4e,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x2,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x1,%edi
call   1030 <DS18B20_write_byte@plt>
movzbl -0x1(%rbp),%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x0,%al
call   1040 <DS18B20_reset@plt>
mov    $0xcc,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x48,%edi
call   1030 <DS18B20_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust_res>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <DS18B20_reset@plt>
mov    $0xcc,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x4e,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x2,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x1,%edi
call   1030 <DS18B20_write_byte@plt>
mov    %ebx,%edi
call   1030 <DS18B20_write_byte@plt>
xor    %eax,%eax
call   1040 <DS18B20_reset@plt>
mov    $0xcc,%edi
call   1030 <DS18B20_write_byte@plt>
mov    $0x48,%edi
pop    %rbx
jmp    1030 <DS18B20_write_byte@plt>

LLVM IR (-O0):
define void @adjust_res(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @DS18B20_reset()
%4 = call i32 @DS18B20_write_byte(i32 204)
%5 = call i32 @DS18B20_write_byte(i32 78)
%6 = call i32 @DS18B20_write_byte(i32 2)
%7 = call i32 @DS18B20_write_byte(i32 1)
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = call i32 @DS18B20_write_byte(i32 %9)
%11 = call i32 (...) @DS18B20_reset()
%12 = call i32 @DS18B20_write_byte(i32 204)
%13 = call i32 @DS18B20_write_byte(i32 72)
ret void
}

LLVM IR (-O2):
define void @adjust_res(i8 zeroext %0) {
%2 = tail call i32 (...) @DS18B20_reset()
%3 = tail call i32 @DS18B20_write_byte(i32 204)
%4 = tail call i32 @DS18B20_write_byte(i32 78)
%5 = tail call i32 @DS18B20_write_byte(i32 2)
%6 = tail call i32 @DS18B20_write_byte(i32 1)
%7 = zext i8 %0 to i32
%8 = tail call i32 @DS18B20_write_byte(i32 %7)
%9 = tail call i32 (...) @DS18B20_reset()
%10 = tail call i32 @DS18B20_write_byte(i32 204)
%11 = tail call i32 @DS18B20_write_byte(i32 72)
ret void
}
int isOperator(char symbol) {
  switch (symbol) {
  case '+':
  case '-':
  case '*':
  case '/':
  case '^':
  case '(':
  case ')':
    return 1;
    break;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<isOperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd8,%eax
sub    $0x4,%eax
jb     1155 <isOperator+0x55>
jmp    1122 <isOperator+0x22>
mov    -0xc(%rbp),%eax
sub    $0x2d,%eax
je     1155 <isOperator+0x55>
jmp    1133 <isOperator+0x33>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
je     1155 <isOperator+0x55>
jmp    1144 <isOperator+0x44>
mov    -0xc(%rbp),%eax
sub    $0x5e,%eax
jne    1161 <isOperator+0x61>
jmp    1155 <isOperator+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1168 <isOperator+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOperator>:
add    $0xffffffd8,%edi
cmp    $0x36,%edi
ja     111e <isOperator+0x1e>
mov    $0x1,%eax
movabs $0x400000000000af,%rcx
bt     %rdi,%rcx
jae    111e <isOperator+0x1e>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isOperator(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 43, label %6
i32 45, label %6
i32 42, label %6
i32 47, label %6
i32 94, label %6
i32 40, label %6
i32 41, label %6
]
6: ; preds = %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @isOperator(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %3 [
i32 43, label %4
i32 45, label %4
i32 42, label %4
i32 47, label %4
i32 94, label %4
i32 40, label %4
i32 41, label %4
]
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %1, %1, %1, %1, %1, %3
%5 = phi i32 [ 0, %3 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ im_a_minion_01();
int /*<<< orphan*/ im_a_minion_02();
int /*<<< orphan*/ im_a_minion_03();
void testFuncGoto(void) {
  im_a_minion_01();
  goto jumpy;
  im_a_minion_02();
jumpy:
  im_a_minion_03();
}


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

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

LLVM IR (-O0):
define void @testFuncGoto() {
%1 = call i32 (...) @im_a_minion_01()
br label %2
2: ; preds = %0
%3 = call i32 (...) @im_a_minion_03()
ret void
}

LLVM IR (-O2):
define void @testFuncGoto() {
%1 = tail call i32 (...) @im_a_minion_01()
%2 = tail call i32 (...) @im_a_minion_03()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ rnl_verror_handler(int, int /*<<< orphan*/);
void verror_handler_rnd(int erno, va_list ap) {
  rnl_verror_handler(erno | 0x02000, ap);
}


x86 assembly (clang, -O0):
<verror_handler_rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
or     $0x2000,%edi
mov    -0x8(%rbp),%esi
call   1030 <rnl_verror_handler@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verror_handler_rnd>:
or     $0x2000,%edi
jmp    1030 <rnl_verror_handler@plt>

LLVM IR (-O0):
define void @verror_handler_rnd(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 = or i32 %5, 8192
%7 = load i32, i32* %4
%8 = call i32 @rnl_verror_handler(i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @verror_handler_rnd(i32 %0, i32 %1) {
%3 = or i32 %0, 8192
%4 = tail call i32 @rnl_verror_handler(i32 %3, i32 %1)
ret void
}
/* Variables and functions */
int lengthOfLongestSubstring(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  char s[] = "abcbef";
  int len = lengthOfLongestSubstring(s);
  printf("%d\n", len);
  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    0xec4(%rip),%eax
mov    %eax,-0x17(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x17(%rbp),%rdi
call   1040 <lengthOfLongestSubstring@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x666562,0x3(%rsp)
movl   $0x62636261,(%rsp)
mov    %rsp,%rdi
call   1040 <lengthOfLongestSubstring@plt>
lea    0xec8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.s = [7 x i8] c"abcbef\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%5 = call i32 @lengthOfLongestSubstring(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
void getString(char *in, char *out) {
  char *q, *p;
  p = strstr(in, "'");
  p++;
  q = strstr(p, "'");
  strcpy(q, "\0");
  strcpy(out, p);
  return;
}


x86 assembly (clang, -O0):
<getString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getString>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    $0x27,%esi
call   1040 <strchr@plt>
lea    0x1(%rax),%rbx
mov    %rbx,%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
lea    0xeb7(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"'\00"
@.str.1 = [2 x i8] zeroinitializer
define void @getString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @strstr(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i8* @strstr(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8*, i8** %4
%16 = load i8*, i8** %6
%17 = call i32 @strcpy(i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
@.str.1 = [2 x i8] zeroinitializer
define void @getString(i8* %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 39)
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = tail call i8* @strchr(i8* %4, i32 39)
%6 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strcpy(i8* %1, i8* %4)
ret void
}
int test_imm_07uint16_reg(unsigned short val) {
  return ((val) & (0x07 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_07uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 7
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int Test(void) {
  struct {
    int x;
  } a;
  struct Type {
    int y;
  } b;
  a.x = 5;
  b.y = a.x;
  return b.y;
}


x86 assembly (clang, -O0):
<Test>:
push   %rbp
mov    %rsp,%rbp
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i32 }
%struct.Type = type { i32 }
define i32 @Test() {
%1 = alloca %struct.anon
%2 = alloca %struct.Type
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
store i32 5, i32* %3
%4 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.Type, %struct.Type* %2, i32 0, i32 0
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.Type, %struct.Type* %2, i32 0, i32 0
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @Test() {
ret i32 5
}
int determinedaycode(int year) {
  int daycode;
  int d1, d2, d3;
  d1 = (year - 1) / 4;
  d2 = (year - 1) / 100;
  d3 = (year - 1) / 400;
  daycode = (year + d1 - d2 + d3) % 7;
  return daycode;
}


x86 assembly (clang, -O0):
<determinedaycode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<determinedaycode>:
lea    -0x1(%rdi),%ecx
lea    0x2(%rdi),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x2,%eax
movslq %ecx,%rcx
imul   $0xffffffffae147ae1,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rdx
sar    $0x5,%edx
add    %esi,%edx
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rcx
sar    $0x7,%ecx
add    %esi,%ecx
add    %edi,%eax
add    %edx,%eax
add    %ecx,%eax
movslq %eax,%rcx
imul   $0xffffffff92492493,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @determinedaycode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = sdiv i32 %8, 4
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = sdiv i32 %11, 100
store i32 %12, i32* %5
%13 = load i32, i32* %2
%14 = sub nsw i32 %13, 1
%15 = sdiv i32 %14, 400
store i32 %15, i32* %6
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %5
%20 = sub nsw i32 %18, %19
%21 = load i32, i32* %6
%22 = add nsw i32 %20, %21
%23 = srem i32 %22, 7
store i32 %23, i32* %3
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @determinedaycode(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sdiv i32 %2, 4
%4 = sdiv i32 %2, -100
%5 = sdiv i32 %2, 400
%6 = add nsw i32 %3, %0
%7 = add i32 %6, %4
%8 = add nsw i32 %7, %5
%9 = srem i32 %8, 7
ret i32 %9
}
int test6(int x) { return x / 10 < 0; }


x86 assembly (clang, -O0):
<test6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test6>:
xor    %eax,%eax
cmp    $0xfffffff7,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @test6(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 10
%5 = icmp slt i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test6(i32 %0) {
%2 = icmp slt i32 %0, -9
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
char *fm_abs(char const *);
int /*<<< orphan*/ free(char *);
int stat(char *, struct stat *);
int fm_exists(const char *file) {
  struct stat s;
  int rv;
  char *fn = fm_abs(file);
  rv = stat(fn, &s);
  free(fn);
  return rv + 1;
}


x86 assembly (clang, -O0):
<fm_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fm_abs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <stat@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fm_exists>:
push   %rbp
push   %rbx
push   %rax
call   1040 <fm_abs@plt>
mov    %rax,%rbx
mov    %rsp,%rsi
mov    %rax,%rdi
call   1050 <stat@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @fm_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @fm_abs(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @stat(i8* %8, %struct.stat* %3)
store i32 %9, i32* %4
%10 = load i8*, i8** %5
%11 = call i32 @free(i8* %10)
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @fm_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = tail call i8* @fm_abs(i8* %0)
%5 = call i32 @stat(i8* %4, %struct.stat* %2)
%6 = tail call i32 @free(i8* %4)
%7 = add nsw i32 %5, 1
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
  ;
  return 0;
}


x86 assembly (clang, -O0):
<sigprocmask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sigprocmask(i32 %0, i32* nocapture readnone %1, i32* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void h_repeat() {
  printf("\tEnter Y to play again with the same players.\n");
  printf("\tEnter R to play again with new players.\n");
  printf("\tAnything else to quit.\n");
}


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

x86 assembly (clang, -O2):
<h_repeat>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf27(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"\09Enter Y to play again with the same players.\0A\00"
@.str.1 = [42 x i8] c"\09Enter R to play again with new players.\0A\00"
@.str.2 = [25 x i8] c"\09Anything else to quit.\0A\00"
define void @h_repeat() {
%1 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [46 x i8] c"\09Enter Y to play again with the same players.\00"
@str.3 = [41 x i8] c"\09Enter R to play again with new players.\00"
@str.4 = [24 x i8] c"\09Anything else to quit.\00"
define void @h_repeat() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
ret void
}
int maior(int x, int y) {
  if (x > y) {
    return x;
  } else if (y > x) {
    return y;
  } else {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<maior>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <maior+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113f <maior+0x3f>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1138 <maior+0x38>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113f <maior+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maior>:
cmp    %edi,%esi
mov    $0x1,%eax
cmovg  %esi,%eax
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @maior(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = icmp sgt i32 %1, %0
%5 = select i1 %4, i32 %1, i32 1
%6 = select i1 %3, i32 %0, i32 %5
ret i32 %6
}
/* Type definitions */
struct grid_db {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ select_time(struct grid_db *, int, int);
void do_select_timesteps(struct grid_db *db, int ts0, int ts1, int flag) {
  int time;
  for (time = ts0; time <= ts1; time++) {
    select_time(db, time - 1, flag);
  }
}


x86 assembly (clang, -O0):
<do_select_timesteps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1157 <do_select_timesteps+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
mov    -0x14(%rbp),%edx
call   1030 <select_time@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112b <do_select_timesteps+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_select_timesteps>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jg     1144 <do_select_timesteps+0x34>
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r15
add    $0xffffffff,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1030 <select_time@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1130 <do_select_timesteps+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.grid_db = type { i32 }
define void @do_select_timesteps(%struct.grid_db* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.grid_db*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.grid_db* %0, %struct.grid_db** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
store i32 %10, i32* %9
br label %11
11: ; preds = %21, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %7
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load %struct.grid_db*, %struct.grid_db** %5
%17 = load i32, i32* %9
%18 = sub nsw i32 %17, 1
%19 = load i32, i32* %8
%20 = call i32 @select_time(%struct.grid_db* %16, i32 %18, i32 %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
store i32 %23, i32* %9
br label %11
24: ; preds = %11
ret void
}

LLVM IR (-O2):
%struct.grid_db = type { i32 }
define void @do_select_timesteps(%struct.grid_db* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, %2
br i1 %5, label %12, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %10, %6 ], [ %1, %4 ]
%8 = add nsw i32 %7, -1
%9 = tail call i32 @select_time(%struct.grid_db* %0, i32 %8, i32 %3)
%10 = add i32 %7, 1
%11 = icmp eq i32 %7, %2
br i1 %11, label %12, label %6
12: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PrintRawData(char *, void *, void *, int /*<<< orphan*/);
void PrintRawDataHex(char *label, void *pfirst, void *plast) {
  PrintRawData(label, pfirst, plast, 0);
}


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

x86 assembly (clang, -O2):
<PrintRawDataHex>:
xor    %ecx,%ecx
jmp    1030 <PrintRawData@plt>

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

LLVM IR (-O2):
define void @PrintRawDataHex(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @PrintRawData(i8* %0, i8* %1, i8* %2, i32 0)
ret void
}
void __frob14(void) {}


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

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

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

LLVM IR (-O2):
define void @__frob14() {
ret void
}
double drelerr(double a, double b) { return (a - b) / a; }


x86 assembly (clang, -O0):
<drelerr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drelerr>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @drelerr(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 = fsub double %5, %6
%8 = load double, double* %3
%9 = fdiv double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @drelerr(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fdiv double %3, %0
ret double %4
}
void swap(int *a, int *b) {
  int n = *b;
  *b = *a;
  *a = n;
}


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

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

LLVM IR (-O0):
define void @swap(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = load i32*, i32** %4
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = load i32, i32* %0
store i32 %4, i32* %1
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int startswith(const char *str, const char *substr) {
  return strncmp(str, substr, strlen(substr)) == 0;
}


x86 assembly (clang, -O0):
<startswith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startswith>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @startswith(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 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i64 @strncmp(i8* %5, i8* %6, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @startswith(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
double const fabs(double const);
int m3dCloseEnoughd(const double dCandidate, const double dCompare,
                    const double dEpsilon) {
  return (fabs(dCandidate - dCompare) < dEpsilon);
}


x86 assembly (clang, -O0):
<m3dCloseEnoughd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m3dCloseEnoughd>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm2
seta   %al
ret

LLVM IR (-O0):
define i32 @m3dCloseEnoughd(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
%10 = call double @fabs(double %9)
%11 = load double, double* %6
%12 = fcmp olt double %10, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @m3dCloseEnoughd(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
unsigned int rightrot(unsigned int x, int n) {
  return (x >> n) | (x << (8 * sizeof(unsigned int) - n));
}


x86 assembly (clang, -O0):
<rightrot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
movslq -0x8(%rbp),%rsi
mov    $0x20,%ecx
sub    %rsi,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rightrot>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @rightrot(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 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = sub i64 32, %10
%12 = trunc i64 %11 to i32
%13 = shl i32 %8, %12
%14 = or i32 %7, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @rightrot(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ atmel_atmega328_PD0_clear__E();
void test20_Blink1_pollen__reset__E() { atmel_atmega328_PD0_clear__E(); }


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

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

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

LLVM IR (-O2):
define void @test20_Blink1_pollen__reset__E() {
%1 = tail call i32 (...) @atmel_atmega328_PD0_clear__E()
ret void
}
void event_info(place) char *place;
{}


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

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

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

LLVM IR (-O2):
define void @event_info(i8* nocapture %0) {
ret void
}
int solution() {}


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

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

LLVM IR (-O0):
define i32 @solution() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @solution() {
ret i32 undef
}
int serial_need_autobaud() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @serial_need_autobaud() {
ret i32 1
}
__attribute((always_)) f(int x) {
  int i = x;
  &x;
  i++;
  return i;
}


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

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int printf(char *, int);
int main(void) {
  int x = 5;
  int ret = printf("x = %d", x);
  printf("ret = %d", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%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    0xee8(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"x = %d\00"
@.str.1 = [9 x i8] c"ret = %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
char *dgettext(char *, char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ put_prog_name();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void fallback_warn() {
  put_prog_name();
  fprintf(stderr,
          dgettext("libtu", "Oops. Error string compilation failed: %s"),
          strerror(errno));
}


x86 assembly (clang, -O0):
<fallback_warn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <put_prog_name@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xe9e(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <dgettext@plt>
mov    %rax,-0x8(%rbp)
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    %eax,%edx
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fallback_warn>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <put_prog_name@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%ebp
lea    0xea6(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1040 <dgettext@plt>
mov    %rax,%rbx
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"libtu\00"
@.str.1 = [42 x i8] c"Oops. Error string compilation failed: %s\00"
@errno = global i32 0
define void @fallback_warn() {
%1 = call i32 (...) @put_prog_name()
%2 = load i32, i32* @stderr
%3 = call i8* @dgettext(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @errno
%5 = call i32 @strerror(i32 %4)
%6 = call i32 @fprintf(i32 %2, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"libtu\00"
@.str.1 = [42 x i8] c"Oops. Error string compilation failed: %s\00"
@errno = global i32 0
define void @fallback_warn() {
%1 = tail call i32 (...) @put_prog_name()
%2 = load i32, i32* @stderr
%3 = tail call i8* @dgettext(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @errno
%5 = tail call i32 @strerror(i32 %4)
%6 = tail call i32 @fprintf(i32 %2, i8* %3, i32 %5)
ret void
}
/* Variables and functions */
int __cxa_atexit(void (*)(void *), void *, void *);
int __attribute__((weak))
__aeabi_atexit(void *object, void (*destructor)(void *), void *dso_handle) {
  return __cxa_atexit(destructor, object, dso_handle);
}


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

x86 assembly (clang, -O2):
<__aeabi_atexit>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <__cxa_atexit@plt>

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

LLVM IR (-O2):
define weak i32 @__aeabi_atexit(i8* %0, void (i8*)* %1, i8* %2) {
%4 = tail call i32 @__cxa_atexit(void (i8*)* %1, i8* %0, i8* %2)
ret i32 %4
}
void testfunc() { char test[] = "Hello World"; }


x86 assembly (clang, -O0):
<testfunc>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xef3(%rip),%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.testfunc.test = [12 x i8] c"Hello World\00"
define void @testfunc() {
%1 = alloca [12 x i8]
%2 = bitcast [12 x i8]* %1 to i8*
ret void
}

LLVM IR (-O2):
define void @testfunc() {
ret void
}
/* Variables and functions */
double fabs(double);
int nearly_equal(double x1, double x2) {
  return (x1 == x2) || (fabs((x2 - x1) / x2) < 0.00001);
}


x86 assembly (clang, -O0):
<nearly_equal>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x11(%rbp)
jne    112e <nearly_equal+0x2e>
jp     112e <nearly_equal+0x2e>
jmp    115a <nearly_equal+0x5a>
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
movaps 0xecc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xeb0(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nearly_equal>:
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
jne    110e <nearly_equal+0xe>
jp     110e <nearly_equal+0xe>
ret
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
andpd  0xede(%rip),%xmm2
movsd  0xee6(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm2,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @nearly_equal(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 oeq double %5, %6
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = load double, double* %4
%10 = load double, double* %3
%11 = fsub double %9, %10
%12 = load double, double* %4
%13 = fdiv double %11, %12
%14 = call double @llvm.fabs.f64(double %13)
%15 = fcmp olt double %14, 1.000000e-05
br label %16
16: ; preds = %8, %2
%17 = phi i1 [ true, %2 ], [ %15, %8 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @nearly_equal(double %0, double %1) {
%3 = fcmp oeq double %0, %1
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = fsub double %1, %0
%6 = fdiv double %5, %1
%7 = tail call double @llvm.fabs.f64(double %6)
%8 = fcmp olt double %7, 1.000000e-05
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %4, %2
%11 = phi i32 [ 1, %2 ], [ %9, %4 ]
ret i32 %11
}