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

/* Variables and functions */
scalar_t__ could_read_w_(struct parser *, char const *, int);
int /*<<< orphan*/ skip(struct parser *, int);
int can_read_w_(struct parser *p, const char *s, int len) {
  if (could_read_w_(p, s, len)) {
    skip(p, len);
    return 1;
  } else {
    return 0;
  }
}


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

x86 assembly (clang, -O2):
<can_read_w_>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1040 <could_read_w_@plt>
test   %rax,%rax
je     1143 <can_read_w_+0x23>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <skip@plt>
mov    $0x1,%eax
jmp    1145 <can_read_w_+0x25>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.parser = type { i32 }
define i32 @can_read_w_(%struct.parser* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.parser*
%6 = alloca i8*
%7 = alloca i32
store %struct.parser* %0, %struct.parser** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load %struct.parser*, %struct.parser** %5
%9 = load i8*, i8** %6
%10 = load i32, i32* %7
%11 = call i64 @could_read_w_(%struct.parser* %8, i8* %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load %struct.parser*, %struct.parser** %5
%15 = load i32, i32* %7
%16 = call i32 @skip(%struct.parser* %14, i32 %15)
store i32 1, i32* %4
br label %18
17: ; preds = %3
store i32 0, i32* %4
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
%struct.parser = type { i32 }
define i32 @can_read_w_(%struct.parser* %0, i8* %1, i32 %2) {
%4 = tail call i64 @could_read_w_(%struct.parser* %0, i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @skip(%struct.parser* %0, i32 %2)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prg) {
  printf("%s <path/to/obj>\n", prg);
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s <path/to/obj>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s <path/to/obj>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
int isalpha(int ch) { return ((unsigned)ch | 32) - 'a' < 26; }


x86 assembly (clang, -O0):
<isalpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x20,%eax
sub    $0x61,%eax
cmp    $0x1a,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha>:
or     $0x20,%edi
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isalpha(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = or i32 %3, 32
%5 = sub i32 %4, 97
%6 = icmp ult i32 %5, 26
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @isalpha(i32 %0) {
%2 = or i32 %0, 32
%3 = add i32 %2, -97
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double get_wtime() {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec + 1.e-6 * tv.tv_usec;
}


x86 assembly (clang, -O0):
<get_wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xecb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_wtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @get_wtime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %6, double %4)
ret double %7
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @get_wtime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %8
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void waitms(int ms) {
  struct timeval tv;
  tv.tv_sec = 0;
  tv.tv_usec = ms * 1000;
  select(0, NULL, NULL, NULL, &tv);
}


x86 assembly (clang, -O0):
<waitms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitms>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
imul   $0x3e8,%edi,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define void @waitms(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 %6, i32* %7
%8 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define void @waitms(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 0, i64* %4
%5 = mul nsw i32 %0, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 %5, i32* %6
%7 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strLen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
void fwriteStr(int f, const char *s) { write(f, s, strLen(s)); }


x86 assembly (clang, -O0):
<fwriteStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strLen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwriteStr>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strLen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @fwriteStr(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strLen(i8* %7)
%9 = call i32 @write(i32 %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @fwriteStr(i32 %0, i8* %1) {
%3 = tail call i32 @strLen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void doc(char *lib_name, char *comment) {
  printf("\n----- Documentation pour %s :\n%s\n-------\n\n", lib_name, comment);
}


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

x86 assembly (clang, -O2):
<doc>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\0A----- Documentation pour %s :\0A%s\0A-------\0A\0A\00"
define void @doc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0A----- Documentation pour %s :\0A%s\0A-------\0A\0A\00"
define void @doc(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, double);
char *strdup(char *);
char *reformat_double_return_string(double d, char *format_string) {
  char return_buffer[128];
  sprintf(return_buffer, format_string, d);
  return strdup(return_buffer);
}


x86 assembly (clang, -O0):
<reformat_double_return_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x8(%rbp),%xmm0
call   1030 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <strdup@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reformat_double_return_string>:
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strdup@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @reformat_double_return_string(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca [128 x i8]
store double %0, double* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = load double, double* %3
%9 = call i32 @sprintf(i8* %6, i8* %7, double %8)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%11 = call i8* @strdup(i8* %10)
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @reformat_double_return_string(double %0, i8* nocapture %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) %1, double %0)
%6 = call i8* @strdup(i8* %4)
ret i8* %6
}
int test_imm_2Auint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x2A << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_2Auint64_highword_mem>:
testb  $0x2a,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_2Auint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 180388626432
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ compare_first_to_subsequent_wrapper_call();
int /*<<< orphan*/ print_average_syscall();
void system_call_wrapper_test(void) {
  compare_first_to_subsequent_wrapper_call();
  print_average_syscall();
}


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

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

LLVM IR (-O0):
define void @system_call_wrapper_test() {
%1 = call i32 (...) @compare_first_to_subsequent_wrapper_call()
%2 = call i32 (...) @print_average_syscall()
ret void
}

LLVM IR (-O2):
define void @system_call_wrapper_test() {
%1 = tail call i32 (...) @compare_first_to_subsequent_wrapper_call()
%2 = tail call i32 (...) @print_average_syscall()
ret void
}
/* Type definitions */
struct sqlConnection {
  int dummy;
};

/* Variables and functions */
char *somePath(struct sqlConnection *, int, char *);
char *genePixThumbSizePath(struct sqlConnection *conn, int id) {
  return somePath(conn, id, "thumbLocation");
}


x86 assembly (clang, -O0):
<genePixThumbSizePath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdx
call   1030 <somePath@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genePixThumbSizePath>:
lea    0xee9(%rip),%rdx
jmp    1030 <somePath@plt>

LLVM IR (-O0):
%struct.sqlConnection = type { i32 }
@.str = [14 x i8] c"thumbLocation\00"
define i8* @genePixThumbSizePath(%struct.sqlConnection* %0, i32 %1) {
%3 = alloca %struct.sqlConnection*
%4 = alloca i32
store %struct.sqlConnection* %0, %struct.sqlConnection** %3
store i32 %1, i32* %4
%5 = load %struct.sqlConnection*, %struct.sqlConnection** %3
%6 = load i32, i32* %4
%7 = call i8* @somePath(%struct.sqlConnection* %5, i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i8* %7
}

LLVM IR (-O2):
%struct.sqlConnection = type { i32 }
@.str = [14 x i8] c"thumbLocation\00"
define i8* @genePixThumbSizePath(%struct.sqlConnection* %0, i32 %1) {
%3 = tail call i8* @somePath(%struct.sqlConnection* %0, i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
long cxRound(double doub) {
  if (doub < 0.0)
    return (long)(doub - 0.5);
  else
    return (long)(doub + 0.5);
}


x86 assembly (clang, -O0):
<cxRound>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1136 <cxRound+0x36>
movsd  -0x10(%rbp),%xmm0
movsd  0xedc(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x8(%rbp)
jmp    114c <cxRound+0x4c>
movsd  0xec2(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cxRound>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @cxRound(double %0) {
%2 = alloca i64
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fsub double %7, 5.000000e-01
%9 = fptosi double %8 to i64
store i64 %9, i64* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fadd double %11, 5.000000e-01
%13 = fptosi double %12 to i64
store i64 %13, i64* %2
br label %14
14: ; preds = %10, %6
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @cxRound(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i64
ret i64 %5
}
/* Type definitions */
struct comp {
  int dummy;
};
struct BrzWhile_ {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SEND_ACKDOWN(int /*<<< orphan*/);
int /*<<< orphan*/ SEND_REQDOWN(int);
void BrzWhile_reqdown(struct comp *comp, int port) {
  struct BrzWhile_ *c = (struct BrzWhile_ *)comp;
  SEND_REQDOWN(1);
  SEND_ACKDOWN(0);
}


x86 assembly (clang, -O0):
<BrzWhile_reqdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
call   1040 <SEND_REQDOWN@plt>
xor    %edi,%edi
call   1030 <SEND_ACKDOWN@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BrzWhile_reqdown>:
push   %rax
mov    $0x1,%edi
call   1040 <SEND_REQDOWN@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <SEND_ACKDOWN@plt>

LLVM IR (-O0):
%struct.comp = type { i32 }
%struct.BrzWhile_ = type { i32 }
define void @BrzWhile_reqdown(%struct.comp* %0, i32 %1) {
%3 = alloca %struct.comp*
%4 = alloca i32
%5 = alloca %struct.BrzWhile_*
store %struct.comp* %0, %struct.comp** %3
store i32 %1, i32* %4
%6 = load %struct.comp*, %struct.comp** %3
%7 = bitcast %struct.comp* %6 to %struct.BrzWhile_*
store %struct.BrzWhile_* %7, %struct.BrzWhile_** %5
%8 = call i32 @SEND_REQDOWN(i32 1)
%9 = call i32 @SEND_ACKDOWN(i32 0)
ret void
}

LLVM IR (-O2):
%struct.comp = type { i32 }
define void @BrzWhile_reqdown(%struct.comp* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @SEND_REQDOWN(i32 1)
%4 = tail call i32 @SEND_ACKDOWN(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void SysCtlIntUnregister(void) {
  IntDisable(44);
  IntUnregister(44);
}


x86 assembly (clang, -O0):
<SysCtlIntUnregister>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2c,%edi
call   1030 <IntDisable@plt>
mov    $0x2c,%edi
call   1040 <IntUnregister@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlIntUnregister>:
push   %rax
mov    $0x2c,%edi
call   1030 <IntDisable@plt>
mov    $0x2c,%edi
pop    %rax
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @SysCtlIntUnregister() {
%1 = call i32 @IntDisable(i32 44)
%2 = call i32 @IntUnregister(i32 44)
ret void
}

LLVM IR (-O2):
define void @SysCtlIntUnregister() {
%1 = tail call i32 @IntDisable(i32 44)
%2 = tail call i32 @IntUnregister(i32 44)
ret void
}
int dummy_message(void *option, char *path, int type, void *info) {
  (void)option;
  (void)path;
  (void)type;
  (void)info;
  return 0;
}


x86 assembly (clang, -O0):
<dummy_message>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @dummy_message(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i8* nocapture readnone %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ get_cmdline();
int /*<<< orphan*/ get_info_string();
int /*<<< orphan*/ get_speed();
extern void init_info() {
  get_speed();
  get_info_string();
  get_cmdline();
}


x86 assembly (clang, -O0):
<init_info>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <get_speed@plt>
mov    $0x0,%al
call   1040 <get_info_string@plt>
mov    $0x0,%al
call   1050 <get_cmdline@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_info>:
push   %rax
xor    %eax,%eax
call   1030 <get_speed@plt>
xor    %eax,%eax
call   1040 <get_info_string@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <get_cmdline@plt>

LLVM IR (-O0):
define void @init_info() {
%1 = call i32 (...) @get_speed()
%2 = call i32 (...) @get_info_string()
%3 = call i32 (...) @get_cmdline()
ret void
}

LLVM IR (-O2):
define void @init_info() {
%1 = tail call i32 (...) @get_speed()
%2 = tail call i32 (...) @get_info_string()
%3 = tail call i32 (...) @get_cmdline()
ret void
}
/* Variables and functions */
unsigned char *llib_led_edit_next_group(unsigned char *);
unsigned char *llib_led_edit_find_last_group(unsigned char *group) {
  unsigned char *s;
  for (s = group; *s && *s != ':'; s = llib_led_edit_next_group(s))
    group = s;
  return group;
}


x86 assembly (clang, -O0):
<llib_led_edit_find_last_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1149 <llib_led_edit_find_last_group+0x39>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x3a,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1159 <llib_led_edit_find_last_group+0x49>
jmp    1173 <llib_led_edit_find_last_group+0x63>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <llib_led_edit_next_group@plt>
mov    %rax,-0x10(%rbp)
jmp    1124 <llib_led_edit_find_last_group+0x14>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llib_led_edit_find_last_group>:
push   %rbx
mov    %rdi,%rax
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%ecx
test   %cl,%cl
je     113f <llib_led_edit_find_last_group+0x2f>
cmp    $0x3a,%cl
je     113f <llib_led_edit_find_last_group+0x2f>
mov    %rbx,%rdi
call   1030 <llib_led_edit_next_group@plt>
mov    %rax,%rcx
mov    %rbx,%rax
mov    %rcx,%rbx
jmp    1120 <llib_led_edit_find_last_group+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @llib_led_edit_find_last_group(i8* %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %4, %6 ]
%4 = phi i8* [ %0, %1 ], [ %7, %6 ]
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %8
i8 58, label %8
]
6: ; preds = %2
%7 = tail call i8* @llib_led_edit_next_group(i8* %4)
br label %2
8: ; preds = %2, %2
ret i8* %3
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
scalar_t__ UINT64_MAX;
int add_uint64_overflows(uint64_t a, uint64_t b) {
  return (b > UINT64_MAX - a);
}


x86 assembly (clang, -O0):
<add_uint64_overflows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ec1(%rip),%rcx
mov    (%rcx),%rcx
sub    -0x8(%rbp),%rcx
cmp    %rcx,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_uint64_overflows>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%rcx
sub    %rdi,%rcx
xor    %eax,%eax
cmp    %rsi,%rcx
setl   %al
ret

LLVM IR (-O0):
@UINT64_MAX = global i64 0
define i32 @add_uint64_overflows(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* @UINT64_MAX
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = icmp sgt i64 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@UINT64_MAX = global i64 0
define i32 @add_uint64_overflows(i64 %0, i64 %1) {
%3 = load i64, i64* @UINT64_MAX
%4 = sub nsw i64 %3, %0
%5 = icmp slt i64 %4, %1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int getmonth(int);
int getyear(int);
int getday(int date) {
  return (date - 10000 * getyear(date) - 100 * getmonth(date));
}


x86 assembly (clang, -O0):
<getday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <getyear@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   $0x2710,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getmonth@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getday>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <getyear@plt>
imul   $0xffffd8f0,%eax,%ebp
add    %ebx,%ebp
mov    %ebx,%edi
call   1030 <getmonth@plt>
imul   $0xffffff9c,%eax,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getday(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @getyear(i32 %4)
%6 = mul nsw i32 10000, %5
%7 = sub nsw i32 %3, %6
%8 = load i32, i32* %2
%9 = call i32 @getmonth(i32 %8)
%10 = mul nsw i32 100, %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @getday(i32 %0) {
%2 = tail call i32 @getyear(i32 %0)
%3 = mul i32 %2, -10000
%4 = add i32 %3, %0
%5 = tail call i32 @getmonth(i32 %0)
%6 = mul i32 %5, -100
%7 = add i32 %4, %6
ret i32 %7
}
int main() {
  int a;
  a;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t __bson_uint16_swap_slow(uint16_t v) {
  return ((v & 0x00FF) << 8) | ((v & 0xFF00) >> 8);
}


x86 assembly (clang, -O0):
<__bson_uint16_swap_slow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__bson_uint16_swap_slow>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @__bson_uint16_swap_slow(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 8
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @__bson_uint16_swap_slow(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ i2cWrite(int, int);
void PCA9685SetOffTime(int ch, int offRegL, int offRegH) {
  int reg = 0x08 + 4 * ch;
  i2cWrite(reg, offRegL);
  i2cWrite(reg + 1, offRegH);
}


x86 assembly (clang, -O0):
<PCA9685SetOffTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <i2cWrite@plt>
mov    -0x10(%rbp),%edi
add    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <i2cWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PCA9685SetOffTime>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %edi,%ebx
lea    0x8(,%rbx,4),%edi
call   1030 <i2cWrite@plt>
lea    0x9(,%rbx,4),%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <i2cWrite@plt>

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

LLVM IR (-O2):
define void @PCA9685SetOffTime(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 %0, 2
%5 = add nsw i32 %4, 8
%6 = tail call i32 @i2cWrite(i32 %5, i32 %1)
%7 = add nsw i32 %4, 9
%8 = tail call i32 @i2cWrite(i32 %7, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _errorloop();
void SVCall_Handler() { _errorloop(); }


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

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

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

LLVM IR (-O2):
define void @SVCall_Handler() {
%1 = tail call i32 (...) @_errorloop()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void printS(char *c) { printf("%c\n", *c); }


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

x86 assembly (clang, -O2):
<printS>:
movsbl (%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define void @printS(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %2)
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int si_code;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void handle_sigfpe(int sig, siginfo_t *info, void *uc) {
  printf(" [FPE %d]", info->si_code);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<handle_sigfpe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_sigfpe>:
push   %rax
mov    (%rsi),%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@.str = [10 x i8] c" [FPE %d]\00"
@stdout = global i32 0
define void @handle_sigfpe(i32 %0, %struct.TYPE_3__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
store i32 %0, i32* %4
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %5
store i8* %2, i8** %6
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@.str = [10 x i8] c" [FPE %d]\00"
@stdout = global i32 0
define void @handle_sigfpe(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
ret void
}
int add(int f, int s) { return (f + s); }


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

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct DynArr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ popDynArr(struct DynArr *);
int /*<<< orphan*/ pushDynArr(struct DynArr *, double);
double topDynArr(struct DynArr *);
void divide(struct DynArr *stack) {
  double i = topDynArr(stack);
  popDynArr(stack);
  double j = topDynArr(stack);
  popDynArr(stack);
  pushDynArr(stack, (j / i));
}


x86 assembly (clang, -O0):
<divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <popDynArr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <popDynArr@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1050 <pushDynArr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1030 <topDynArr@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1040 <popDynArr@plt>
mov    %rbx,%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1040 <popDynArr@plt>
movsd  (%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <pushDynArr@plt>

LLVM IR (-O0):
%struct.DynArr = type { i32 }
define void @divide(%struct.DynArr* %0) {
%2 = alloca %struct.DynArr*
%3 = alloca double
%4 = alloca double
store %struct.DynArr* %0, %struct.DynArr** %2
%5 = load %struct.DynArr*, %struct.DynArr** %2
%6 = call double @topDynArr(%struct.DynArr* %5)
store double %6, double* %3
%7 = load %struct.DynArr*, %struct.DynArr** %2
%8 = call i32 @popDynArr(%struct.DynArr* %7)
%9 = load %struct.DynArr*, %struct.DynArr** %2
%10 = call double @topDynArr(%struct.DynArr* %9)
store double %10, double* %4
%11 = load %struct.DynArr*, %struct.DynArr** %2
%12 = call i32 @popDynArr(%struct.DynArr* %11)
%13 = load %struct.DynArr*, %struct.DynArr** %2
%14 = load double, double* %4
%15 = load double, double* %3
%16 = fdiv double %14, %15
%17 = call i32 @pushDynArr(%struct.DynArr* %13, double %16)
ret void
}

LLVM IR (-O2):
%struct.DynArr = type { i32 }
define void @divide(%struct.DynArr* %0) {
%2 = tail call double @topDynArr(%struct.DynArr* %0)
%3 = tail call i32 @popDynArr(%struct.DynArr* %0)
%4 = tail call double @topDynArr(%struct.DynArr* %0)
%5 = tail call i32 @popDynArr(%struct.DynArr* %0)
%6 = fdiv double %4, %2
%7 = tail call i32 @pushDynArr(%struct.DynArr* %0, double %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(void *);
int date_get_sec(void) {
  time_t t;
  struct tm *lt;
  t = time((void *)0);
  lt = localtime(&t);
  return lt->tm_sec;
}


x86 assembly (clang, -O0):
<date_get_sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_get_sec>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @date_get_sec() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i8* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @date_get_sec() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i8* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ write_ZIGBEE_long(int, int);
void disable_PLL() { write_ZIGBEE_long(0x202, 0x00); }


x86 assembly (clang, -O0):
<disable_PLL>:
push   %rbp
mov    %rsp,%rbp
mov    $0x202,%edi
xor    %esi,%esi
call   1030 <write_ZIGBEE_long@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_PLL>:
mov    $0x202,%edi
xor    %esi,%esi
jmp    1030 <write_ZIGBEE_long@plt>

LLVM IR (-O0):
define void @disable_PLL() {
%1 = call i32 @write_ZIGBEE_long(i32 514, i32 0)
ret void
}

LLVM IR (-O2):
define void @disable_PLL() {
%1 = tail call i32 @write_ZIGBEE_long(i32 514, i32 0)
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void UARTDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000048))) |= ui32DMAFlags;
}


x86 assembly (clang, -O0):
<UARTDMAEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x48(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x48(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTDMAEnable>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
mov    -0x8(%rsp),%rcx
or     %rax,0x48(%rcx)
ret

LLVM IR (-O0):
define void @UARTDMAEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 72
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @UARTDMAEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 72
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}
/* Variables and functions */
int icmp(int, int);
int memcmp(char const *, char const *, int);
int scmp(const char *s1, int l1, const char *s2, int l2) {
  int r = memcmp(s1, s2, (l1 < l2) ? l1 : l2);
  return r ? r : icmp(l1, l2);
}


x86 assembly (clang, -O0):
<scmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <scmp+0x3d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    1163 <scmp+0x43>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
call   1030 <memcmp@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     118b <scmp+0x6b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    1199 <scmp+0x79>
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <icmp@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scmp>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %esi,%ebp
cmp    %ecx,%esi
mov    %ecx,%eax
cmovl  %esi,%eax
mov    %rdx,%rsi
mov    %eax,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
je     1143 <scmp+0x23>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <icmp@plt>

LLVM IR (-O0):
define i32 @scmp(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %7
%12 = load i32, i32* %6
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = load i32, i32* %6
br label %19
17: ; preds = %4
%18 = load i32, i32* %8
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %18, %17 ]
%21 = call i32 @memcmp(i8* %10, i8* %11, i32 %20)
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = load i32, i32* %9
br label %30
26: ; preds = %19
%27 = load i32, i32* %6
%28 = load i32, i32* %8
%29 = call i32 @icmp(i32 %27, i32 %28)
br label %30
30: ; preds = %26, %24
%31 = phi i32 [ %25, %24 ], [ %29, %26 ]
ret i32 %31
}

LLVM IR (-O2):
define i32 @scmp(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp slt i32 %1, %3
%6 = select i1 %5, i32 %1, i32 %3
%7 = tail call i32 @memcmp(i8* %0, i8* %2, i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @icmp(i32 %1, i32 %3)
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ %10, %9 ], [ %7, %4 ]
ret i32 %12
}
long get_whole_seconds(const double seconds) { return (long)seconds; }


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

x86 assembly (clang, -O2):
<get_whole_seconds>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @get_whole_seconds(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @get_whole_seconds(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ example(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Undefined behavior:\n");
  example(0);
  printf("Correct!:\n");
  example(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <example@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <example@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <example@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <example@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Undefined behavior:\0A\00"
@.str.1 = [11 x i8] c"Correct!:\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @example(i32 0)
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @example(i32 1)
ret i32 0
}

LLVM IR (-O2):
@str = [20 x i8] c"Undefined behavior:\00"
@str.2 = [10 x i8] c"Correct!:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @example(i32 0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @example(i32 1)
ret i32 0
}
void callee_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @callee_2_2_2() {
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ ssh_fatal(char *, ...);
void *ssh_malloc(size_t size) {
  void *ptr;
  if (size == 0)
    ssh_fatal("xmalloc: zero size");
  ptr = malloc(size);
  if (ptr == NULL)
    ssh_fatal("xmalloc: out of memory (allocating %zu bytes)", size);
  return ptr;
}


x86 assembly (clang, -O0):
<ssh_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1145 <ssh_malloc+0x25>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <ssh_fatal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <ssh_malloc+0x4f>
mov    -0x8(%rbp),%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <ssh_fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssh_malloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
jne    113a <ssh_malloc+0x1a>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <ssh_fatal@plt>
mov    %r14,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115b <ssh_malloc+0x3b>
lea    0xec2(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <ssh_fatal@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"xmalloc: zero size\00"
@.str.1 = [46 x i8] c"xmalloc: out of memory (allocating %zu bytes)\00"
define i8* @ssh_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @ssh_fatal(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i64, i64* %2
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i64, i64* %2
%15 = call i32 (i8*, ...) @ssh_fatal(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %13, %8
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [19 x i8] c"xmalloc: zero size\00"
@.str.1 = [46 x i8] c"xmalloc: out of memory (allocating %zu bytes)\00"
define noalias i8* @ssh_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @ssh_fatal(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i8* @malloc(i64 %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @ssh_fatal(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i64 %0)
br label %10
10: ; preds = %8, %5
ret i8* %6
}
/* Variables and functions */
int f();
int h(void) { return f(); }


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

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

LLVM IR (-O0):
define i32 @h() {
%1 = call i32 (...) @f()
ret i32 %1
}

LLVM IR (-O2):
define i32 @h() {
%1 = tail call i32 (...) @f()
ret i32 %1
}