xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  long tv_usec;
};
struct itimerval {
  TYPE_1__ it_value;
};

/* Variables and functions */
void _set_itimerval_value_tvusec(struct itimerval *timer, long tv_usec) {
  timer->it_value.tv_usec = tv_usec;
}


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

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

LLVM IR (-O0):
%struct.itimerval = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
define void @_set_itimerval_value_tvusec(%struct.itimerval* %0, i64 %1) {
%3 = alloca %struct.itimerval*
%4 = alloca i64
store %struct.itimerval* %0, %struct.itimerval** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load %struct.itimerval*, %struct.itimerval** %3
%7 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %6, i32 0, i32 0
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
%struct.itimerval = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
define void @_set_itimerval_value_tvusec(%struct.itimerval* nocapture writeonly %0, i64 %1) {
%3 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %0, i64 0, i32 0, i32 0
store i64 %1, i64* %3
ret void
}
void qpnp_kick_s2_timer(void) {}


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

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

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

LLVM IR (-O2):
define void @qpnp_kick_s2_timer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello World\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ debug_print(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void main() {
  int i = 0;
  for (i = 0; i < 11; i += 2) {
    debug_print(i);
    int j;
    for (j = 0; j < 500000000; j++) {
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xb,-0x4(%rbp)
jge    1182 <main+0x62>
mov    -0x4(%rbp),%edi
call   1040 <debug_print@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1dcd6500,-0x8(%rbp)
jge    116f <main+0x4f>
jmp    1161 <main+0x41>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <main+0x2f>
jmp    1174 <main+0x54>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <main+0x16>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <debug_print@plt>
mov    $0x2,%edi
call   1040 <debug_print@plt>
mov    $0x4,%edi
call   1040 <debug_print@plt>
mov    $0x6,%edi
call   1040 <debug_print@plt>
mov    $0x8,%edi
call   1040 <debug_print@plt>
mov    $0xa,%edi
call   1040 <debug_print@plt>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %1
br label %3
3: ; preds = %17, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 11
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @debug_print(i32 %7)
store i32 0, i32* %2
br label %9
9: ; preds = %13, %6
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 500000000
br i1 %11, label %12, label %16
12: ; preds = %9
br label %13
13: ; preds = %12
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %9
16: ; preds = %9
br label %17
17: ; preds = %16
%18 = load i32, i32* %1
%19 = add nsw i32 %18, 2
store i32 %19, i32* %1
br label %3
20: ; preds = %3
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @debug_print(i32 0)
%2 = tail call i32 @debug_print(i32 2)
%3 = tail call i32 @debug_print(i32 4)
%4 = tail call i32 @debug_print(i32 6)
%5 = tail call i32 @debug_print(i32 8)
%6 = tail call i32 @debug_print(i32 10)
%7 = tail call i32 @exit(i32 0)
unreachable
}
void SPI_LEDS_EnableRxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPI_LEDS_EnableRxInt() {
ret void
}
int stmp3xxx_valid_pin(unsigned pin) {
  return (pin / 32) < 4 && (pin % 32) < 32;
}


x86 assembly (clang, -O0):
<stmp3xxx_valid_pin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
shr    $0x5,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
mov    %al,-0x5(%rbp)
jae    112a <stmp3xxx_valid_pin+0x2a>
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
cmp    $0x20,%eax
setb   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stmp3xxx_valid_pin>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @stmp3xxx_valid_pin(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 32
%5 = icmp ult i32 %4, 4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = urem i32 %7, 32
%9 = icmp ult i32 %8, 32
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @stmp3xxx_valid_pin(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void system_reboot() { exit(1); }


x86 assembly (clang, -O0):
<system_reboot>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<system_reboot>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @system_reboot() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @system_reboot() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ dio_set(unsigned char, unsigned char);
void DIOSetTerminate(unsigned char pin, unsigned char value) {
  dio_set(pin, value);
}


x86 assembly (clang, -O0):
<DIOSetTerminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
movzbl %al,%edi
movzbl -0x2(%rbp),%esi
call   1030 <dio_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DIOSetTerminate>:
jmp    1030 <dio_set@plt>

LLVM IR (-O0):
define void @DIOSetTerminate(i8 zeroext %0, i8 zeroext %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 @dio_set(i8 zeroext %5, i8 zeroext %6)
ret void
}

LLVM IR (-O2):
define void @DIOSetTerminate(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @dio_set(i8 zeroext %0, i8 zeroext %1)
ret void
}
/* Type definitions */
struct wpa_ctrl {
  int dummy;
};

/* Variables and functions */
int wpa_ctrl_command(struct wpa_ctrl *, char *);
int wpa_cli_cmd_reconfigure(struct wpa_ctrl *ctrl, int argc,
                            const char *argv[]) {
  return wpa_ctrl_command(ctrl, "RECONFIGURE");
}


x86 assembly (clang, -O0):
<wpa_cli_cmd_reconfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <wpa_ctrl_command@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.wpa_ctrl = type { i32 }
@.str = [12 x i8] c"RECONFIGURE\00"
define i32 @wpa_cli_cmd_reconfigure(%struct.wpa_ctrl* %0, i32 %1, i8** %2) {
%4 = alloca %struct.wpa_ctrl*
%5 = alloca i32
%6 = alloca i8**
store %struct.wpa_ctrl* %0, %struct.wpa_ctrl** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load %struct.wpa_ctrl*, %struct.wpa_ctrl** %4
%8 = call i32 @wpa_ctrl_command(%struct.wpa_ctrl* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %8
}

LLVM IR (-O2):
%struct.wpa_ctrl = type { i32 }
@.str = [12 x i8] c"RECONFIGURE\00"
define i32 @wpa_cli_cmd_reconfigure(%struct.wpa_ctrl* %0, i32 %1, i8** nocapture readnone %2) {
%4 = tail call i32 @wpa_ctrl_command(%struct.wpa_ctrl* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}
void XkbForceBell() {}


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

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

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

LLVM IR (-O2):
define void @XkbForceBell() {
ret void
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char *data;
  printf("Content-Type: text/plain\n\n");
  data = getenv("QUERY_STRING");
  printf("Query_String = '%s'", data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rdi
call   1030 <getenv@plt>
lea    0xebd(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Content-Type: text/plain\0A\0A\00"
@.str.1 = [13 x i8] c"QUERY_STRING\00"
@.str.2 = [20 x i8] c"Query_String = '%s'\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"QUERY_STRING\00"
@.str.2 = [20 x i8] c"Query_String = '%s'\00"
@str = [26 x i8] c"Content-Type: text/plain\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int /*<<< orphan*/ __swahw32p(int /*<<< orphan*/ *);
void __swahw32s(__u32 *addr) {
  do {
    *(addr) = __swahw32p((addr));
  } while (0);
}


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

x86 assembly (clang, -O2):
<__swahw32s>:
push   %rbx
mov    %rdi,%rbx
call   1030 <__swahw32p@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @__swahw32s(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
br label %3
3: ; preds = %1
%4 = load i32*, i32** %2
%5 = call i32 @__swahw32p(i32* %4)
%6 = load i32*, i32** %2
store i32 %5, i32* %6
br label %7
7: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @__swahw32s(i32* %0) {
%2 = tail call i32 @__swahw32p(i32* %0)
store i32 %2, i32* %0
ret void
}
/* Variables and functions */
int merge(int, int, char *);
void Quicksort(int low, int high, char s[]) {
  int pi = merge(low, high, s);
  if (low < high) {
    Quicksort(low, pi - 1, s);
    Quicksort(pi + 1, high, s);
  }
}


x86 assembly (clang, -O0):
<Quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1040 <merge@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1174 <Quicksort+0x54>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%rdx
call   1030 <Quicksort@plt>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <Quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %edi,%ebx
call   1040 <merge@plt>
cmp    %r15d,%ebx
jge    1166 <Quicksort+0x46>
mov    %eax,%ebp
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbp),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   1030 <Quicksort@plt>
mov    %ebp,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r14,%rdx
call   1040 <merge@plt>
mov    %eax,%ebp
cmp    %r15d,%ebx
jl     1140 <Quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @Quicksort(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @merge(i32 %0, i32 %1, i8* %2)
%5 = icmp slt i32 %0, %1
br i1 %5, label %6, label %13
6: ; preds = %3, %6
%7 = phi i32 [ %11, %6 ], [ %4, %3 ]
%8 = phi i32 [ %10, %6 ], [ %0, %3 ]
%9 = add nsw i32 %7, -1
tail call void @Quicksort(i32 %8, i32 %9, i8* %2)
%10 = add nsw i32 %7, 1
%11 = tail call i32 @merge(i32 %10, i32 %1, i8* %2)
%12 = icmp slt i32 %10, %1
br i1 %12, label %6, label %13
13: ; preds = %6, %3
ret void
}
int sgs_getbin(char c) { return c - '0'; }


x86 assembly (clang, -O0):
<sgs_getbin>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sgs_getbin(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @sgs_getbin(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
int fibo(int n) {
  if (n == 0)
    return 0;
  if (n == 1)
    return 1;
  else
    return fibo(n - 1) + fibo(n - 2);
}


x86 assembly (clang, -O0):
<fibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <fibo+0x21>
movl   $0x0,-0x4(%rbp)
jmp    116a <fibo+0x5a>
cmpl   $0x1,-0x8(%rbp)
jne    1147 <fibo+0x37>
movl   $0x1,-0x4(%rbp)
jmp    116a <fibo+0x5a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibo@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibo@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%ebx
jb     1132 <fibo+0x22>
nopl   0x0(%rax)
lea    -0x1(%rbx),%edi
call   1030 <fibo@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x2,%ebx
jae    1120 <fibo+0x10>
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fibo(i32 %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i32 [ 0, %1 ], [ %10, %6 ]
%4 = phi i32 [ %0, %1 ], [ %9, %6 ]
%5 = icmp ult i32 %4, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = add nsw i32 %4, -1
%8 = tail call i32 @fibo(i32 %7)
%9 = add nsw i32 %4, -2
%10 = add nsw i32 %8, %3
br label %2
11: ; preds = %2
%12 = add nsw i32 %4, %3
ret i32 %12
}
void halIntOff(void) { ; }


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

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

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

LLVM IR (-O2):
define void @halIntOff() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, long long);
int write_devattr(char const *, char *);
int write_devattr_slonglong(const char *attr, long long value) {
  char buf[100];
  snprintf(buf, 100, "%lld", value);
  return write_devattr(attr, buf);
}


x86 assembly (clang, -O0):
<write_devattr_slonglong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x64,%esi
lea    0xeb9(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <write_devattr@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_devattr_slonglong>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xecc(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x64,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <write_devattr@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
define i32 @write_devattr_slonglong(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [100 x i8]
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = load i64, i64* %4
%8 = call i32 @snprintf(i8* %6, i32 100, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%11 = call i32 @write_devattr(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
define i32 @write_devattr_slonglong(i8* %0, i64 %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 100, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %1)
%6 = call i32 @write_devattr(i8* %0, i8* %4)
ret i32 %6
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
long long tst_timespec_to_ms(struct timespec t) {
  return t.tv_sec * 1000 + (t.tv_nsec + 500000) / 1000000;
}


x86 assembly (clang, -O0):
<tst_timespec_to_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7a120,%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_timespec_to_ms>:
imul   $0x3e8,%edi,%eax
shr    $0x20,%rdi
add    $0x7a120,%edi
movslq %edi,%rcx
imul   $0x431bde83,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i64 @tst_timespec_to_ms(i64 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i64*
store i64 %0, i64* %3
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 500000
%10 = sdiv i32 %9, 1000000
%11 = add nsw i32 %6, %10
%12 = sext i32 %11 to i64
ret i64 %12
}

LLVM IR (-O2):
define i64 @tst_timespec_to_ms(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i64 %0, 32
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %2, 1000
%6 = add nsw i32 %4, 500000
%7 = sdiv i32 %6, 1000000
%8 = add nsw i32 %7, %5
%9 = sext i32 %8 to i64
ret i64 %9
}
void reverse_string(char *h, char *t) {
  while (h < t) {
    ((*h) ^= (*t), (*t) ^= (*h), (*h) ^= (*t));
    ++h;
    --t;
  }
}


x86 assembly (clang, -O0):
<reverse_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    116d <reverse_string+0x6d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <reverse_string+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_string>:
cmp    %rsi,%rdi
jae    1130 <reverse_string+0x30>
add    $0x1,%rdi
nopl   0x0(%rax)
movzbl -0x1(%rdi),%eax
xor    (%rsi),%al
mov    %al,-0x1(%rdi)
xor    (%rsi),%al
mov    %al,(%rsi)
xor    %al,-0x1(%rdi)
add    $0xffffffffffffffff,%rsi
lea    0x1(%rdi),%rax
cmp    %rsi,%rdi
mov    %rax,%rdi
jb     1110 <reverse_string+0x10>
ret

LLVM IR (-O0):
define void @reverse_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %9, %2
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = icmp ult i8* %6, %7
br i1 %8, label %9, label %38
9: ; preds = %5
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = xor i32 %15, %12
%17 = trunc i32 %16 to i8
store i8 %17, i8* %13
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = xor i32 %23, %20
%25 = trunc i32 %24 to i8
store i8 %25, i8* %21
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i8*, i8** %3
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = xor i32 %31, %28
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %3
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i32 -1
store i8* %37, i8** %4
br label %5
38: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @reverse_string(i8* %0, i8* %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %17
4: ; preds = %2, %4
%5 = phi i8* [ %15, %4 ], [ %1, %2 ]
%6 = phi i8* [ %14, %4 ], [ %0, %2 ]
%7 = load i8, i8* %5
%8 = load i8, i8* %6
%9 = xor i8 %8, %7
store i8 %9, i8* %6
%10 = load i8, i8* %5
%11 = xor i8 %10, %9
store i8 %11, i8* %5
%12 = load i8, i8* %6
%13 = xor i8 %12, %11
store i8 %13, i8* %6
%14 = getelementptr inbounds i8, i8* %6, i64 1
%15 = getelementptr inbounds i8, i8* %5, i64 -1
%16 = icmp ult i8* %14, %15
br i1 %16, label %4, label %17
17: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_send(char const);
void uart_writeline(const char *data) {
  unsigned int i = 0;
  while (data[i] != '\0') {
    uart_send(data[i++]);
  }
  uart_send('\n');
}


x86 assembly (clang, -O0):
<uart_writeline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1156 <uart_writeline+0x46>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <uart_send@plt>
jmp    1123 <uart_writeline+0x13>
mov    $0xa,%edi
call   1030 <uart_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_writeline>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1145 <uart_writeline+0x35>
mov    %rdi,%rbx
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <uart_send@plt>
mov    %ebp,%eax
movzbl (%rbx,%rax,1),%eax
add    $0x1,%ebp
test   %al,%al
jne    1130 <uart_writeline+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <uart_send@plt>

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

LLVM IR (-O2):
define void @uart_writeline(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %7, %4 ], [ 0, %1 ]
%7 = add i32 %6, 1
%8 = tail call i32 @uart_send(i8 signext %5)
%9 = zext i32 %7 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = tail call i32 @uart_send(i8 signext 10)
ret void
}
/* Variables and functions */
char *utilStrTrimChar(char *, char *);
char *utilStrTrim(char *sStr) { return utilStrTrimChar(sStr, " \t\r\n"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0D\0A\00"
define i8* @utilStrTrim(i8* %0) {
%2 = tail call i8* @utilStrTrimChar(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
FILE *startFile() {
  FILE *log;
  log = fopen("graphics.log", "a");
  if (log != NULL)
    fprintf(log, "---\n");
  return log;
}


x86 assembly (clang, -O0):
<startFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115a <startFile+0x3a>
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startFile>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xede(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1155 <startFile+0x35>
lea    0xecc(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"graphics.log\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [5 x i8] c"---\0A\00"
define i32* @startFile() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32*, i32** %1
%7 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %5, %0
%9 = load i32*, i32** %1
ret i32* %9
}

LLVM IR (-O2):
@.str = [13 x i8] c"graphics.log\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [5 x i8] c"---\0A\00"
define noalias i32* @startFile() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 1, i32* %1)
br label %5
5: ; preds = %3, %0
ret i32* %1
}
int f5(int a, int b) { return a - (unsigned)(b & a); }


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

x86 assembly (clang, -O2):
<f5>:
mov    %esi,%eax
not    %eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f5(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = and i32 %3, %0
ret i32 %4
}
float slamch(char cmach) {
  extern float slamch_(char *cmach);
  return slamch_(&cmach);
}


x86 assembly (clang, -O0):
<slamch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
call   1030 <slamch_@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slamch>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rdi
call   1030 <slamch_@plt>
pop    %rax
ret

LLVM IR (-O0):
define float @slamch(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call float @slamch_(i8* %2)
ret float %3
}

LLVM IR (-O2):
define float @slamch(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call float @slamch_(i8* %2)
ret float %3
}
int main() { return 3; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Type definitions */
struct graph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_edge(struct graph *, int, int);
void add_edge_maybe(struct graph *g, int a, int b) {
  if (b < 0)
    return;
  add_edge(g, a, b);
}


x86 assembly (clang, -O0):
<add_edge_maybe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1131 <add_edge_maybe+0x21>
jmp    1140 <add_edge_maybe+0x30>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <add_edge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_edge_maybe>:
test   %edx,%edx
js     1119 <add_edge_maybe+0x9>
jmp    1030 <add_edge@plt>
ret

LLVM IR (-O0):
%struct.graph = type { i32 }
define void @add_edge_maybe(%struct.graph* %0, i32 %1, i32 %2) {
%4 = alloca %struct.graph*
%5 = alloca i32
%6 = alloca i32
store %struct.graph* %0, %struct.graph** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %3
br label %15
10: ; preds = %3
%11 = load %struct.graph*, %struct.graph** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @add_edge(%struct.graph* %11, i32 %12, i32 %13)
br label %15
15: ; preds = %10, %9
ret void
}

LLVM IR (-O2):
%struct.graph = type { i32 }
define void @add_edge_maybe(%struct.graph* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @add_edge(%struct.graph* %0, i32 %1, i32 %2)
br label %7
7: ; preds = %3, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __assert_fail();
int main() {
  int x = 0;
  while (1) {
    x++;
    if (x == 2) {
      x = 0;
    }
    if (x >= 2) {
      __assert_fail();
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1140 <main+0x30>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     115c <main+0x4c>
mov    $0x0,%al
call   1030 <__assert_fail@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1126 <main+0x16>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, char const *, char const *);
char *make_path(const char *path, const char *file) {
  char *filename;
  asprintf(&filename, "%s/%s", path, file);
  return filename;
}


x86 assembly (clang, -O0):
<make_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <asprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_path>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee2(%rip),%rsi
mov    %rsp,%rdi
call   1030 <asprintf@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define i8* @make_path(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = load i8*, i8** %3
ret i8* %6
}
/* Type definitions */
typedef int ssize_t;
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ __ptr_t;
typedef int /*<<< orphan*/ __CONST_SOCKADDR_ARG;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
ssize_t __sendto(int fd, const __ptr_t buf, size_t n, int flags,
                 __CONST_SOCKADDR_ARG addr, socklen_t addr_len) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sendto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sendto>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__sendto(i32 %0, i32 %1, i64 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* @ENOSYS
%14 = call i32 @__set_errno(i32 %13)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__sendto(i32 %0, i32 %1, i64 %2, i32 %3, i32 %4, i32 %5) {
%7 = load i32, i32* @ENOSYS
%8 = tail call i32 @__set_errno(i32 %7)
ret i32 -1
}
/* Variables and functions */
void *Cyc_BansheeIf_composite_constraint(unsigned int, void *, void *);
void *Cyc_BansheeIf_or_constraint(void *c1, void *c2) {
  void *_T0;
  _T0 = Cyc_BansheeIf_composite_constraint(1U, c1, c2);
  return _T0;
}


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

x86 assembly (clang, -O2):
<Cyc_BansheeIf_or_constraint>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <Cyc_BansheeIf_composite_constraint@plt>

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

LLVM IR (-O2):
define i8* @Cyc_BansheeIf_or_constraint(i8* %0, i8* %1) {
%3 = tail call i8* @Cyc_BansheeIf_composite_constraint(i32 1, i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ Say(char *, int);
void hit(void) { Say("Teaparty!", 1); }


x86 assembly (clang, -O0):
<hit>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <Say@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hit>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <Say@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Teaparty!\00"
define void @hit() {
%1 = call i32 @Say(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Teaparty!\00"
define void @hit() {
%1 = tail call i32 @Say(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *, char *);
_warn(char *msg) { printk("*** Warning: %s UNIMPLEMENTED!\n", msg); }


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

x86 assembly (clang, -O2):
<_warn>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printk@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"*** Warning: %s UNIMPLEMENTED!\0A\00"
define i32 @_warn(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @printk(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [32 x i8] c"*** Warning: %s UNIMPLEMENTED!\0A\00"
define i32 @_warn(i8* %0) {
%2 = tail call i32 @printk(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
long next_triangle_num();
void next_triangle_num_test(void) {
  long num = 0;
  for (size_t i = 0; i < 10; i++)
    num = next_triangle_num();
  assert(num == 55);
}


x86 assembly (clang, -O0):
<next_triangle_num_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0xa,-0x10(%rbp)
jae    115f <next_triangle_num_test+0x3f>
mov    $0x0,%al
call   1030 <next_triangle_num@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <next_triangle_num_test+0x18>
cmpq   $0x37,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_triangle_num_test>:
push   %rax
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %eax,%eax
call   1030 <next_triangle_num@plt>
xor    %edi,%edi
cmp    $0x37,%rax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @next_triangle_num_test() {
%1 = alloca i64
%2 = alloca i64
store i64 0, i64* %1
store i64 0, i64* %2
br label %3
3: ; preds = %8, %0
%4 = load i64, i64* %2
%5 = icmp ult i64 %4, 10
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i64 (...) @next_triangle_num()
store i64 %7, i64* %1
br label %8
8: ; preds = %6
%9 = load i64, i64* %2
%10 = add i64 %9, 1
store i64 %10, i64* %2
br label %3
11: ; preds = %3
%12 = load i64, i64* %1
%13 = icmp eq i64 %12, 55
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret void
}

LLVM IR (-O2):
define void @next_triangle_num_test() {
%1 = tail call i64 (...) @next_triangle_num()
%2 = tail call i64 (...) @next_triangle_num()
%3 = tail call i64 (...) @next_triangle_num()
%4 = tail call i64 (...) @next_triangle_num()
%5 = tail call i64 (...) @next_triangle_num()
%6 = tail call i64 (...) @next_triangle_num()
%7 = tail call i64 (...) @next_triangle_num()
%8 = tail call i64 (...) @next_triangle_num()
%9 = tail call i64 (...) @next_triangle_num()
%10 = tail call i64 (...) @next_triangle_num()
%11 = icmp eq i64 %10, 55
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int,
                           void const *, void const *);
int /*<<< orphan*/ stderr;
void assert_equal_ptr(const void *actual, const void *expected,
                      const char *file, int line) {
  if (expected != actual) {
    fprintf(stderr, "%s:%d expected %p, got %p\n", file, line, expected,
            actual);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<assert_equal_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     1173 <assert_equal_ptr+0x53>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    -0x8(%rbp),%r9
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_equal_ptr>:
cmp    %rdi,%rsi
jne    1126 <assert_equal_ptr+0x6>
ret
push   %rax
mov    %rsi,%r8
mov    %rdi,%r9
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"%s:%d expected %p, got %p\0A\00"
define void @assert_equal_ptr(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = icmp ne i8* %9, %10
br i1 %11, label %12, label %20
12: ; preds = %4
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = load i8*, i8** %6
%17 = load i8*, i8** %5
%18 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15, i8* %16, i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"%s:%d expected %p, got %p\0A\00"
define void @assert_equal_ptr(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = icmp eq i8* %1, %0
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3, i8* %1, i8* %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long int ftell(FILE *stream) {
  long int rc;
  return rc;
}


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

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

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

LLVM IR (-O2):
define i64 @ftell(i32* nocapture readnone %0) {
ret i64 undef
}
/* Variables and functions */
int /*<<< orphan*/ PrintErrorCode();
int dxl_read_word(int, int);
int round(int);
int getPos(int Id) {
  int CurrentPos;
  CurrentPos = dxl_read_word(Id, 36);
  PrintErrorCode();
  return round(CurrentPos * 0.87890625);
}


x86 assembly (clang, -O0):
<getPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x24,%esi
call   1030 <dxl_read_word@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <PrintErrorCode@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea1(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <round@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPos>:
push   %rbx
mov    $0x24,%esi
call   1030 <dxl_read_word@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <PrintErrorCode@plt>
cvtsi2sd %ebx,%xmm0
mulsd  0xeb0(%rip),%xmm0
cvttsd2si %xmm0,%edi
pop    %rbx
jmp    1050 <round@plt>

LLVM IR (-O0):
define i32 @getPos(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dxl_read_word(i32 %4, i32 36)
store i32 %5, i32* %3
%6 = call i32 (...) @PrintErrorCode()
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 0x3FEC200000000000
%10 = fptosi double %9 to i32
%11 = call i32 @round(i32 %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @getPos(i32 %0) {
%2 = tail call i32 @dxl_read_word(i32 %0, i32 36)
%3 = tail call i32 (...) @PrintErrorCode()
%4 = sitofp i32 %2 to double
%5 = fmul double %4, 0x3FEC200000000000
%6 = fptosi double %5 to i32
%7 = tail call i32 @round(i32 %6)
ret i32 %7
}