xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
void cmd_cd(int argc, char **argv) {
  if (argc > 1) {
    chdir(argv[1]);
  }
}


x86 assembly (clang, -O0):
<cmd_cd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1136 <cmd_cd+0x26>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <chdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_cd>:
cmp    $0x2,%edi
jl     111e <cmd_cd+0xe>
mov    0x8(%rsi),%rdi
jmp    1030 <chdir@plt>
ret

LLVM IR (-O0):
define void @cmd_cd(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @chdir(i8* %10)
br label %12
12: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @cmd_cd(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @chdir(i8* %6)
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void intfunc(int a) { printf("int: %d\n", a); }


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

x86 assembly (clang, -O2):
<intfunc>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"int: %d\0A\00"
define void @intfunc(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int subNum(int a, int b) { return (a - b); }


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

x86 assembly (clang, -O2):
<subNum>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @subNum(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @subNum(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
int arch_unw_user_mode(const void *info) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @arch_unw_user_mode(i8* nocapture readnone %0) {
ret i32 0
}
unsigned long long _rdmsr(unsigned int msr) {
  unsigned long long val;
  asm volatile("rdmsr" : "=A"(val) : "c"(msr));
  return val;
}


x86 assembly (clang, -O0):
<_rdmsr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
rdmsr
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rdmsr>:
mov    %edi,%ecx
rdmsr
ret

LLVM IR (-O0):
define i64 @_rdmsr(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 asm sideeffect "rdmsr", "=A,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @_rdmsr(i32 %0) {
%2 = tail call i64 asm sideeffect "rdmsr", "=A,{cx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i64 %2
}
/* Variables and functions */
char *ft_strchr(char *, char);
int /*<<< orphan*/ ft_strcpy(char *, char *);
int ft_check_line(char *buff) {
  char *str;
  if ((str = ft_strchr(buff, '\n'))) {
    ft_strcpy(buff, (str + 1));
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<ft_check_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1040 <ft_strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1165 <ft_check_line+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1030 <ft_strcpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    116c <ft_check_line+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_check_line>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%esi
call   1040 <ft_strchr@plt>
test   %rax,%rax
je     1149 <ft_check_line+0x29>
add    $0x1,%rax
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <ft_strcpy@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ft_check_line(i8* %0) {
%2 = tail call i8* @ft_strchr(i8* %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = tail call i32 @ft_strcpy(i8* %0, i8* %5)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %8
}
int test_imm_E5int16_reg(short val) {
  return ((val) & (0xE5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E5int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 229
%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_E5int16_reg(i16 signext %0) {
%2 = and i16 %0, 229
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print_hex(char *, int);
int /*<<< orphan*/ printf(char *, int);
int read(int, char *, int);
void _recv(int sockfd) {
  int n;
  char recvBuf[2024];
  n = read(sockfd, recvBuf, 2024);
  printf("recv %zd bytes\n", n);
  print_hex(recvBuf, n);
}


x86 assembly (clang, -O0):
<_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x7f0(%rbp),%rsi
mov    $0x7e8,%edx
call   1040 <read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x7f0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <print_hex@plt>
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_recv>:
push   %rbp
push   %rbx
sub    $0x7e8,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x7e8,%edx
call   1040 <read@plt>
mov    %eax,%ebp
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <print_hex@plt>
add    $0x7e8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"recv %zd bytes\0A\00"
define void @_recv(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2024 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [2024 x i8], [2024 x i8]* %4, i64 0, i64 0
%7 = call i32 @read(i32 %5, i8* %6, i32 2024)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [2024 x i8], [2024 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* %3
%12 = call i32 @print_hex(i8* %10, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"recv %zd bytes\0A\00"
define void @_recv(i32 %0) {
%2 = alloca [2024 x i8]
%3 = getelementptr inbounds [2024 x i8], [2024 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 2024)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @print_hex(i8* %3, i32 %4)
ret void
}
int test() {
  volatile int i;
  volatile char foo = 0xFF, bar = 0xAA;
  volatile int qux = 0;
  for (i = 0; i < (foo - bar); i += 0x1) {
    qux++;
  }
  return qux;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
movb   $0xff,-0x5(%rbp)
movb   $0xaa,-0x6(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x5(%rbp),%cl
movsbl %cl,%ecx
mov    -0x6(%rbp),%dl
movsbl %dl,%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    114a <test+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111a <test+0x1a>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
movb   $0xff,-0x9(%rsp)
movb   $0xaa,-0xa(%rsp)
movl   $0x0,-0x4(%rsp)
movl   $0x0,-0x8(%rsp)
nopw   0x0(%rax,%rax,1)
mov    -0x8(%rsp),%eax
movsbl -0x9(%rsp),%ecx
movsbl -0xa(%rsp),%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    1140 <test+0x40>
addl   $0x1,-0x4(%rsp)
addl   $0x1,-0x8(%rsp)
jmp    1120 <test+0x20>
mov    -0x4(%rsp),%eax
ret

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

LLVM IR (-O2):
define i32 @test() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store volatile i8 -1, i8* %2
store volatile i8 -86, i8* %3
%6 = bitcast i32* %4 to i8*
store volatile i32 0, i32* %4
store volatile i32 0, i32* %1
%7 = load volatile i32, i32* %1
%8 = load volatile i8, i8* %2
%9 = sext i8 %8 to i32
%10 = load volatile i8, i8* %3
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %9, %11
%13 = icmp slt i32 %7, %12
br i1 %13, label %14, label %26
14: ; preds = %0, %14
%15 = load volatile i32, i32* %4
%16 = add nsw i32 %15, 1
store volatile i32 %16, i32* %4
%17 = load volatile i32, i32* %1
%18 = add nsw i32 %17, 1
store volatile i32 %18, i32* %1
%19 = load volatile i32, i32* %1
%20 = load volatile i8, i8* %2
%21 = sext i8 %20 to i32
%22 = load volatile i8, i8* %3
%23 = sext i8 %22 to i32
%24 = sub nsw i32 %21, %23
%25 = icmp slt i32 %19, %24
br i1 %25, label %14, label %26
26: ; preds = %14, %0
%27 = load volatile i32, i32* %4
ret i32 %27
}
unsigned int eruConfigureETL1(unsigned int exs_a_input,
                              unsigned int exs_b_input, unsigned int exicon) {
  unsigned int exisel = (*((volatile unsigned int *const)(0x40010600 + 0x00)));
  exisel &= !((3 << 4) | (3 << 6));
  exisel |= ((exs_a_input << 4) | (exs_b_input << 6));
  (*((volatile unsigned int *const)(0x40010600 + 0x00))) = exisel;
  (*((volatile unsigned int *const)(0x40010600 + 0x14))) = exicon;
  return 0;
}


x86 assembly (clang, -O0):
<eruConfigureETL1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x40010600,%eax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
mov    -0x8(%rbp),%ecx
shl    $0x6,%ecx
or     %ecx,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    $0x40010600,%eax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    $0x40010614,%eax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eruConfigureETL1>:
mov    0x40010600,%eax
shl    $0x4,%edi
shl    $0x6,%esi
or     %edi,%esi
mov    %esi,0x40010600
mov    %edx,0x40010614
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @eruConfigureETL1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load volatile i32, i32* inttoptr (i64 1073808896 to i32*)
store i32 %8, i32* %7
%9 = load i32, i32* %7
%10 = and i32 %9, 0
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = shl i32 %11, 4
%13 = load i32, i32* %5
%14 = shl i32 %13, 6
%15 = or i32 %12, %14
%16 = load i32, i32* %7
%17 = or i32 %16, %15
store i32 %17, i32* %7
%18 = load i32, i32* %7
store volatile i32 %18, i32* inttoptr (i64 1073808896 to i32*)
%19 = load i32, i32* %6
store volatile i32 %19, i32* inttoptr (i64 1073808916 to i32*)
ret i32 0
}

LLVM IR (-O2):
define i32 @eruConfigureETL1(i32 %0, i32 %1, i32 %2) {
%4 = load volatile i32, i32* inttoptr (i64 1073808896 to i32*)
%5 = shl i32 %0, 4
%6 = shl i32 %1, 6
%7 = or i32 %6, %5
store volatile i32 %7, i32* inttoptr (i64 1073808896 to i32*)
store volatile i32 %2, i32* inttoptr (i64 1073808916 to i32*)
ret i32 0
}
/* Variables and functions */
unsigned int rand();
unsigned int myrand(unsigned int limit) {
  unsigned int ui = rand();
  return ui % limit;
}


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

x86 assembly (clang, -O2):
<myrand>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
xor    %edx,%edx
div    %ebx
mov    %edx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @myrand(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = urem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
scalar_t__ os_fd_set_cloexec(int);
int set_cloexec_or_close(int fd) {
  if (os_fd_set_cloexec(fd) != 0) {
    close(fd);
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<set_cloexec_or_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <os_fd_set_cloexec@plt>
cmp    $0x0,%rax
je     1151 <set_cloexec_or_close+0x31>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <set_cloexec_or_close+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cloexec_or_close>:
push   %rbx
mov    %edi,%ebx
call   1030 <os_fd_set_cloexec@plt>
test   %rax,%rax
je     1139 <set_cloexec_or_close+0x19>
mov    %ebx,%edi
call   1040 <close@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @set_cloexec_or_close(i32 %0) {
%2 = tail call i64 @os_fd_set_cloexec(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @close(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ %0, %1 ]
ret i32 %7
}
/* Variables and functions */
float cos(int);
int /*<<< orphan*/ printf(char *, float);
void calc() {
  float d = cos(90);
  printf("cosine of 90 is %f", d);
}


x86 assembly (clang, -O0):
<calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5a,%edi
call   1040 <cos@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc>:
push   %rax
mov    $0x5a,%edi
call   1040 <cos@plt>
lea    0xece(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"cosine of 90 is %f\00"
define void @calc() {
%1 = alloca float
%2 = call float @cos(i32 90)
store float %2, float* %1
%3 = load float, float* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), float %3)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"cosine of 90 is %f\00"
define void @calc() {
%1 = tail call float @cos(i32 90)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), float %1)
ret void
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, unsigned short);
void RNDResponseSink_RenderingControl_GetRedVideoBlackLevel(
    struct UPnPService *Service, int ErrorCode, void *User,
    unsigned short CurrentRedVideoBlackLevel) {
  printf("RND Invoke Response: "
         "RenderingControl/GetRedVideoBlackLevel[ErrorCode:%d](%u)\r\n",
         ErrorCode, CurrentRedVideoBlackLevel);
}


x86 assembly (clang, -O0):
<RNDResponseSink_RenderingControl_GetRedVideoBlackLevel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0xc(%rbp),%esi
lea    0xecc(%rip),%rdi
movzwl -0x1a(%rbp),%edx
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNDResponseSink_RenderingControl_GetRedVideoBlackLevel>:
lea    0xee9(%rip),%rdi
mov    %ecx,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [80 x i8] c"RND Invoke Response: RenderingControl/GetRedVideoBlackLevel[ErrorCode:%d](%u)\0D\0A\00"
define void @RNDResponseSink_RenderingControl_GetRedVideoBlackLevel(%struct.UPnPService* %0, i32 %1, i8* %2, i16 zeroext %3) {
%5 = alloca %struct.UPnPService*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i16
store %struct.UPnPService* %0, %struct.UPnPService** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i16 %3, i16* %8
%9 = load i32, i32* %6
%10 = load i16, i16* %8
%11 = call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i32 %9, i16 zeroext %10)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [80 x i8] c"RND Invoke Response: RenderingControl/GetRedVideoBlackLevel[ErrorCode:%d](%u)\0D\0A\00"
define void @RNDResponseSink_RenderingControl_GetRedVideoBlackLevel(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i16 zeroext %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i32 %1, i16 zeroext %3)
ret void
}
double f(double x) { return 4.0 / (1.0 + x * x); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xee9(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xed5(%rip),%xmm0
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mulsd  %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
movsd  0xef4(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double %3, double %4, double 1.000000e+00)
%6 = fdiv double 4.000000e+00, %5
ret double %6
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%3 = fdiv double 4.000000e+00, %2
ret double %3
}
/* Variables and functions */
double vec3_norm(double *);
void vec3_normalize(double v[3]) {
  double n = vec3_norm(v);
  v[0] /= n;
  v[1] /= n;
  v[2] /= n;
}


x86 assembly (clang, -O0):
<vec3_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <vec3_norm@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_normalize>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec3_norm@plt>
movupd (%rbx),%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movupd %xmm1,(%rbx)
movsd  0x10(%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @vec3_normalize(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = call double @vec3_norm(double* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = fdiv double %9, %6
store double %10, double* %8
%11 = load double, double* %3
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = fdiv double %14, %11
store double %15, double* %13
%16 = load double, double* %3
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = fdiv double %19, %16
store double %20, double* %18
ret void
}

LLVM IR (-O2):
define void @vec3_normalize(double* %0) {
%2 = tail call double @vec3_norm(double* %0)
%3 = bitcast double* %0 to <2 x double>*
%4 = load <2 x double>, <2 x double>* %3
%5 = insertelement <2 x double> poison, double %2, i64 0
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%7 = fdiv <2 x double> %4, %6
%8 = bitcast double* %0 to <2 x double>*
store <2 x double> %7, <2 x double>* %8
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = fdiv double %10, %2
store double %11, double* %9
ret void
}
/* Variables and functions */
char *minitextdomain(char *a) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @minitextdomain(i8* nocapture readnone %0) {
ret i8* null
}
int ToLower(int iChar) {
  return (iChar >= 'A' && iChar <= 'Z') ? 'a' + (iChar - 'A') : iChar;
}


x86 assembly (clang, -O0):
<ToLower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     112c <ToLower+0x2c>
cmpl   $0x5a,-0x4(%rbp)
jg     112c <ToLower+0x2c>
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <ToLower+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ToLower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 65
%11 = add nsw i32 97, %10
br label %14
12: ; preds = %5, %1
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %11, %8 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @ToLower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
void HwMdWriteSram(unsigned char byte, unsigned short offset) {
  while ((*(volatile unsigned short *)0x20004020))
    ;
  (*(volatile unsigned short *)0x20004022) = offset;
  (*(volatile unsigned short *)0x20004020) = 0x0200 | byte;
  while ((*(volatile unsigned short *)0x20004020))
    ;
}


x86 assembly (clang, -O0):
<HwMdWriteSram>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    $0x20004020,%eax
mov    (%rax),%ax
cmp    $0x0,%ax
je     1128 <HwMdWriteSram+0x28>
jmp    1111 <HwMdWriteSram+0x11>
mov    -0x4(%rbp),%cx
mov    $0x20004022,%eax
mov    %cx,(%rax)
movzbl -0x1(%rbp),%eax
or     $0x200,%eax
mov    %ax,%cx
mov    $0x20004020,%eax
mov    %cx,(%rax)
mov    $0x20004020,%eax
mov    (%rax),%ax
cmp    $0x0,%ax
je     115f <HwMdWriteSram+0x5f>
jmp    1148 <HwMdWriteSram+0x48>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HwMdWriteSram>:
cmpw   $0x0,0x20004020
jne    1100 <HwMdWriteSram>
mov    %si,0x20004022
20
movzbl %dil,%eax
or     $0x200,%eax
mov    %ax,0x20004020
20
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpw   $0x0,0x20004020
jne    1130 <HwMdWriteSram+0x30>
ret

LLVM IR (-O0):
define void @HwMdWriteSram(i8 zeroext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
br label %5
5: ; preds = %8, %2
%6 = load volatile i16, i16* inttoptr (i64 536887328 to i16*)
%7 = icmp ne i16 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
br label %5
9: ; preds = %5
%10 = load i16, i16* %4
store volatile i16 %10, i16* inttoptr (i64 536887330 to i16*)
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 512, %12
%14 = trunc i32 %13 to i16
store volatile i16 %14, i16* inttoptr (i64 536887328 to i16*)
br label %15
15: ; preds = %18, %9
%16 = load volatile i16, i16* inttoptr (i64 536887328 to i16*)
%17 = icmp ne i16 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %15
19: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @HwMdWriteSram(i8 zeroext %0, i16 zeroext %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i16, i16* inttoptr (i64 536887328 to i16*)
%5 = icmp eq i16 %4, 0
br i1 %5, label %6, label %3
6: ; preds = %3
store volatile i16 %1, i16* inttoptr (i64 536887330 to i16*)
%7 = zext i8 %0 to i16
%8 = or i16 %7, 512
store volatile i16 %8, i16* inttoptr (i64 536887328 to i16*)
br label %9
9: ; preds = %9, %6
%10 = load volatile i16, i16* inttoptr (i64 536887328 to i16*)
%11 = icmp eq i16 %10, 0
br i1 %11, label %12, label %9
12: ; preds = %9
ret void
}
const char *get_salutation(void) { return "Hi there"; }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"Hi there\00"
define i8* @get_salutation() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"Hi there\00"
define i8* @get_salutation() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
void EndThisThread() {}


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

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

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

LLVM IR (-O2):
define void @EndThisThread() {
ret void
}
double limit(double a, double b) {
  if (a < -b)
    return -b;
  if (a > b)
    return b;
  return a;
}


x86 assembly (clang, -O0):
<limit>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    115f <limit+0x5f>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1188 <limit+0x88>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    117e <limit+0x7e>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1188 <limit+0x88>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<limit>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm1,%xmm2
minsd  %xmm0,%xmm1
cmpltsd %xmm2,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm1,%xmm3
andpd  %xmm2,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @limit(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fneg double %7
%9 = fcmp olt double %6, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load double, double* %5
%12 = fneg double %11
store double %12, double* %3
br label %21
13: ; preds = %2
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double, double* %5
store double %18, double* %3
br label %21
19: ; preds = %13
%20 = load double, double* %4
store double %20, double* %3
br label %21
21: ; preds = %19, %17, %10
%22 = load double, double* %3
ret double %22
}

LLVM IR (-O2):
define double @limit(double %0, double %1) {
%3 = fneg double %1
%4 = fcmp ogt double %3, %0
%5 = fcmp ogt double %0, %1
%6 = select i1 %5, double %1, double %0
%7 = select i1 %4, double %3, double %6
ret double %7
}
void op_stop(void *_a, void *_b) {}


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

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

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

LLVM IR (-O2):
define void @op_stop(i8* nocapture %0, i8* nocapture %1) {
ret void
}
int main(void) {
  char value1 = 1, value2 = 0;
  if (value1 == 1)
    value2 = 1;
  if (value2 == 0)
    value1 = 0;
  else
    value1 = 2;
  if (value1 != 1) {
    value1++;
    value2--;
  } else {
    value1--;
    value2++;
  }
  return (value1) ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x1,-0x5(%rbp)
movb   $0x0,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jne    1124 <main+0x24>
movb   $0x1,-0x6(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x0,%eax
jne    113a <main+0x3a>
movb   $0x0,-0x5(%rbp)
jmp    113e <main+0x3e>
movb   $0x2,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
je     1160 <main+0x60>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
mov    -0x6(%rbp),%al
add    $0xff,%al
mov    %al,-0x6(%rbp)
jmp    1170 <main+0x70>
mov    -0x5(%rbp),%al
add    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x6(%rbp),%al
add    $0x1,%al
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t now;
  struct tm *timenow;
  char strtemp[255];
  time(&now);
  timenow = localtime(&now);
  printf("recent time is : %s\n", asctime(timenow));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <time@plt>
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe85(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1040 <asctime@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [21 x i8] c"recent time is : %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [255 x i8]
store i32 0, i32* %1
%5 = call i32 @time(i32* %2)
%6 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %6, %struct.tm** %3
%7 = load %struct.tm*, %struct.tm** %3
%8 = call i8* @asctime(%struct.tm* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [21 x i8] c"recent time is : %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i8* @asctime(%struct.tm* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
/* Variables and functions */
int sscanf(char const *, char *, int *, int *);
int args_getint(const char *arg, int *len) {
  int temp;
  *len = 0;
  int ret = sscanf(arg, "%d%n", &temp, len);
  if ((ret == 0) || (!*len))
    return 0;
  return temp;
}


x86 assembly (clang, -O0):
<args_getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
lea    0xec7(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     115c <args_getint+0x4c>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1168 <args_getint+0x58>
movl   $0x0,-0x4(%rbp)
jmp    116e <args_getint+0x5e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<args_getint>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movl   $0x0,(%rsi)
lea    0xedb(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rcx
call   1030 <sscanf@plt>
test   %eax,%eax
je     1142 <args_getint+0x32>
mov    (%rbx),%eax
test   %eax,%eax
je     1144 <args_getint+0x34>
mov    0xc(%rsp),%eax
jmp    1144 <args_getint+0x34>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%n\00"
define i32 @args_getint(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%8 = load i32*, i32** %5
store i32 0, i32* %8
%9 = load i8*, i8** %4
%10 = load i32*, i32** %5
%11 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %14, %2
store i32 0, i32* %3
br label %21
19: ; preds = %14
%20 = load i32, i32* %6
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %18
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%n\00"
define i32 @args_getint(i8* nocapture %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %1
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
%10 = load i32, i32* %3
%11 = select i1 %9, i32 0, i32 %10
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ 0, %2 ], [ %11, %7 ]
ret i32 %13
}
/* Variables and functions */
scalar_t__ isdigit(char const);
int _char_is_numeric(const char *in_source, long in_offset, long in_length) {
  if (isdigit(in_source[in_offset]))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<_char_is_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     114b <_char_is_numeric+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1152 <_char_is_numeric+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_char_is_numeric>:
push   %rax
movsbl (%rdi,%rsi,1),%edi
call   1030 <isdigit@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @_char_is_numeric(i8* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %1
%5 = load i8, i8* %4
%6 = tail call i64 @isdigit(i8 signext %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
void set_window_size(unsigned col, unsigned row) {}


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

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

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

LLVM IR (-O2):
define void @set_window_size(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double precoFabrica;
  scanf("%lf", &precoFabrica);
  double percentualFornecedor = precoFabrica * 0.12;
  double impostos = precoFabrica * 0.3;
  double precoFinal = precoFabrica + percentualFornecedor + impostos;
  printf("O VALOR DO CARRO E = %0.2f\n", precoFinal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xec1(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xea7(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xebf(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [28 x i8] c"O VALOR DO CARRO E = %0.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%7 = load double, double* %2
%8 = fmul double %7, 1.200000e-01
store double %8, double* %3
%9 = load double, double* %2
%10 = fmul double %9, 3.000000e-01
store double %10, double* %4
%11 = load double, double* %2
%12 = load double, double* %3
%13 = fadd double %11, %12
%14 = load double, double* %4
%15 = fadd double %13, %14
store double %15, double* %5
%16 = load double, double* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), double %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [28 x i8] c"O VALOR DO CARRO E = %0.2f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fmul double %4, 1.200000e-01
%6 = fmul double %4, 3.000000e-01
%7 = fadd double %4, %5
%8 = fadd double %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), double %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ m136getParams(int /*<<< orphan*/);
int /*<<< orphan*/ m172doBitRev(int /*<<< orphan*/);
uint8_t m172getParams(uint16_t addr) {
  return m172doBitRev(m136getParams(addr));
}


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

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

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

LLVM IR (-O2):
define i32 @m172getParams(i32 %0) {
%2 = tail call i32 @m136getParams(i32 %0)
%3 = tail call i32 @m172doBitRev(i32 %2)
ret i32 %3
}
/* Variables and functions */
double const M_PI;
int sin(double const);
double EtrivAlt(const double k1, const double k3, const double k4) {
  return 4 * sin(M_PI * (k1 - k3)) * sin(M_PI * (k1 - k4));
}


x86 assembly (clang, -O0):
<EtrivAlt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    0x2eba(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
shl    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e96(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EtrivAlt>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm0,(%rsp)
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0xeba(%rip),%xmm0
call   1030 <sin@plt>
imul   %ebx,%eax
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = constant double 0.000000e+00
define double @EtrivAlt(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* @M_PI
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fsub double %8, %9
%11 = fmul double %7, %10
%12 = call i32 @sin(double %11)
%13 = mul nsw i32 4, %12
%14 = load double, double* @M_PI
%15 = load double, double* %4
%16 = load double, double* %6
%17 = fsub double %15, %16
%18 = fmul double %14, %17
%19 = call i32 @sin(double %18)
%20 = mul nsw i32 %13, %19
%21 = sitofp i32 %20 to double
ret double %21
}

LLVM IR (-O2):
@M_PI = constant double 0.000000e+00
define double @EtrivAlt(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fmul double %4, 0.000000e+00
%6 = tail call i32 @sin(double %5)
%7 = shl nsw i32 %6, 2
%8 = fsub double %0, %2
%9 = fmul double %8, 0.000000e+00
%10 = tail call i32 @sin(double %9)
%11 = mul nsw i32 %7, %10
%12 = sitofp i32 %11 to double
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void cleanup(void *arg) { printf("No. %d clean-up procdure\n", *((int *)arg)); }


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

x86 assembly (clang, -O2):
<cleanup>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"No. %d clean-up procdure\0A\00"
define void @cleanup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"No. %d clean-up procdure\0A\00"
define void @cleanup(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}