xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printIntResult(int *digits) {
  int i = 21 - 1;
  while (i >= 0) {
    if (*(digits + i) != 0)
      printf("%d", *(digits + i));
    i--;
  }
}


x86 assembly (clang, -O0):
<printIntResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1164 <printIntResult+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1156 <printIntResult+0x46>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printIntResult+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printIntResult>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x14,%ebx
lea    0xedc(%rip),%r14
jmp    1136 <printIntResult+0x26>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rbx
jae    1148 <printIntResult+0x38>
mov    (%r15,%rbx,4),%esi
test   %esi,%esi
je     1130 <printIntResult+0x20>
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    1130 <printIntResult+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printIntResult(i32* nocapture %0) {
br label %2
2: ; preds = %1, %9
%3 = phi i64 [ 20, %1 ], [ %10, %9 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %9
9: ; preds = %7, %2
%10 = add nsw i64 %3, -1
%11 = icmp eq i64 %3, 0
br i1 %11, label %12, label %2
12: ; preds = %9
ret void
}
long int longint_ignoring_unsignedshortint(long int x, unsigned short int y) {
  return x;
}


x86 assembly (clang, -O0):
<longint_ignoring_unsignedshortint>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<longint_ignoring_unsignedshortint>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @longint_ignoring_unsignedshortint(i64 %0, i16 zeroext %1) {
%3 = alloca i64
%4 = alloca i16
store i64 %0, i64* %3
store i16 %1, i16* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @longint_ignoring_unsignedshortint(i64 returned %0, i16 zeroext %1) {
ret i64 %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ remove(char const *);
int main(int argc, const char *argv[]) {
  if (argc != 2) {
    printf("wrong argument\n");
    exit(-1);
  }
  if (remove(argv[1]) < 0) {
    perror("remove");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1176 <main+0x36>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
jge    1199 <main+0x59>
lea    0xe7c(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1166 <main+0x26>
mov    0x8(%rsi),%rdi
call   1030 <remove@plt>
test   %rax,%rax
js     1158 <main+0x18>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea1(%rip),%rdi
call   1050 <perror@plt>
jmp    1154 <main+0x14>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"wrong argument\0A\00"
@.str.1 = [7 x i8] c"remove\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @remove(i8* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"remove\00"
@str = [15 x i8] c"wrong argument\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @remove(i8* %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
ret i32 0
}
int row_byte_euc(int row) { return 0xa1 + row; }


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

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

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

LLVM IR (-O2):
define i32 @row_byte_euc(i32 %0) {
%2 = add nsw i32 %0, 161
ret i32 %2
}
/* Type definitions */
struct chat_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ chat_disconnect(struct chat_state *, int);
unsigned command_disconnect(struct chat_state *state, int argc, char **argv) {
  (void)argv;
  if (argc != 0) {
    return 2;
  }
  chat_disconnect(state, 2);
  return 0;
}


x86 assembly (clang, -O0):
<command_disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1139 <command_disconnect+0x29>
movl   $0x2,-0x4(%rbp)
jmp    114e <command_disconnect+0x3e>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1030 <chat_disconnect@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_disconnect>:
mov    $0x2,%eax
test   %esi,%esi
je     111a <command_disconnect+0xa>
ret
push   %rax
mov    $0x2,%esi
call   1030 <chat_disconnect@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
%struct.chat_state = type { i32 }
define i32 @command_disconnect(%struct.chat_state* %0, i32 %1, i8** nocapture readnone %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @chat_disconnect(%struct.chat_state* %0, i32 2)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ 0, %5 ], [ 2, %3 ]
ret i32 %8
}
int main() {
  signed short int si;
  signed char c;
  si = 0;
  c = 0x01;
  si = c;
  si = 0;
  c = 0xFF;
  si = c;
  si = 0;
  c = 0x80;
  si = c;
  si = 0;
  c = 0x7F;
  si = c;
  si = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
movb   $0x1,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x6(%rbp)
movb   $0xff,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x6(%rbp)
movb   $0x80,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x6(%rbp)
movb   $0x7f,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x6(%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 = alloca i16
%3 = alloca i8
store i32 0, i32* %1
store i16 0, i16* %2
store i8 1, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i16
store i16 %5, i16* %2
store i16 0, i16* %2
store i8 -1, i8* %3
%6 = load i8, i8* %3
%7 = sext i8 %6 to i16
store i16 %7, i16* %2
store i16 0, i16* %2
store i8 -128, i8* %3
%8 = load i8, i8* %3
%9 = sext i8 %8 to i16
store i16 %9, i16* %2
store i16 0, i16* %2
store i8 127, i8* %3
%10 = load i8, i8* %3
%11 = sext i8 %10 to i16
store i16 %11, i16* %2
store i16 0, i16* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
void Default_CLOCK_POWER_IRQHandler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Default_CLOCK_POWER_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Default_CLOCK_POWER_IRQHandler+0x9>
jmp    1109 <Default_CLOCK_POWER_IRQHandler+0x9>

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

LLVM IR (-O0):
define void @Default_CLOCK_POWER_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Default_CLOCK_POWER_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void helpAndLeave(const char *progname, int status) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS)
    stream = stdout;
  fprintf(stream, "Usage: %s [-n VALUE] [COMMAND]\n", progname);
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndLeave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <helpAndLeave+0x3d>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndLeave>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2ea3(%rip),%rax
cmp    %esi,(%rax)
jne    113a <helpAndLeave+0x1a>
mov    0x2ea0(%rip),%rax
jmp    1141 <helpAndLeave+0x21>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [32 x i8] c"Usage: %s [-n VALUE] [COMMAND]\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32*, i32** @stderr
store i32* %6, i32** %5
%7 = load i32, i32* %4
%8 = load i32, i32* @EXIT_SUCCESS
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdout
store i32* %11, i32** %5
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %5
%14 = load i8*, i8** %3
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %4
%17 = call i32 @exit(i32 %16)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [32 x i8] c"Usage: %s [-n VALUE] [COMMAND]\0A\00"
define void @helpAndLeave(i8* %0, i32 %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp eq i32 %3, %1
%5 = load i32*, i32** @stdout
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %5, i32* %6
%8 = tail call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 %1)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
float bswap_flt(float x) {
  union {
    uint32_t i;
    float f;
  } u;
  u.f = x;
  u.i = ((((u.i) & 0xff000000) >> 24) | (((u.i) & 0x00ff0000) >> 8) |
         (((u.i) & 0x0000ff00) << 8) | (((u.i) & 0x000000ff) << 24));
  return u.f;
}


x86 assembly (clang, -O0):
<bswap_flt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x8(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_flt>:
movd   %xmm0,%eax
bswap  %eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define float @bswap_flt(float %0) {
%2 = alloca float
%3 = alloca %union.anon
store float %0, float* %2
%4 = load float, float* %2
%5 = bitcast %union.anon* %3 to float*
store float %4, float* %5
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
%8 = and i32 %7, -16777216
%9 = lshr i32 %8, 24
%10 = bitcast %union.anon* %3 to i32*
%11 = load i32, i32* %10
%12 = and i32 %11, 16711680
%13 = ashr i32 %12, 8
%14 = or i32 %9, %13
%15 = bitcast %union.anon* %3 to i32*
%16 = load i32, i32* %15
%17 = and i32 %16, 65280
%18 = shl i32 %17, 8
%19 = or i32 %14, %18
%20 = bitcast %union.anon* %3 to i32*
%21 = load i32, i32* %20
%22 = and i32 %21, 255
%23 = shl i32 %22, 24
%24 = or i32 %19, %23
%25 = bitcast %union.anon* %3 to i32*
store i32 %24, i32* %25
%26 = bitcast %union.anon* %3 to float*
%27 = load float, float* %26
ret float %27
}

LLVM IR (-O2):
define float @bswap_flt(float %0) {
%2 = bitcast float %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = bitcast i32 %3 to float
ret float %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ getdelim(char **, size_t *, char, int /*<<< orphan*/ *);
ssize_t getline(char **restrict s, size_t *restrict n, FILE *restrict f) {
  return getdelim(s, n, '\n', f);
}


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

x86 assembly (clang, -O2):
<getline>:
mov    %rdx,%rcx
mov    $0xa,%edx
jmp    1030 <getdelim@plt>

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

LLVM IR (-O2):
define i32 @getline(i8** noalias %0, i64* noalias %1, i32* noalias %2) {
%4 = tail call i32 @getdelim(i8** %0, i64* %1, i8 signext 10, i32* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int sum = 0;
  int *p = &sum;
  for (int i = 0; i < 1000; i++) {
    *p = *p + 1;
  }
  assert(sum == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    115f <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <main+0x25>
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_MAKE_ONE_WIRE_OUTPUT() { set_io_bit(0x72, 5); }


x86 assembly (clang, -O0):
<TOSH_MAKE_ONE_WIRE_OUTPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x72,%edi
mov    $0x5,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_ONE_WIRE_OUTPUT>:
mov    $0x72,%edi
mov    $0x5,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_ONE_WIRE_OUTPUT() {
%1 = call i32 @set_io_bit(i32 114, i32 5)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_ONE_WIRE_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 114, i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AbsoluteIndexedXX0(int);
int /*<<< orphan*/ ROR8(int /*<<< orphan*/);
void Op7EM1X0(void) { ROR8(AbsoluteIndexedXX0(3)); }


x86 assembly (clang, -O0):
<Op7EM1X0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <AbsoluteIndexedXX0@plt>
mov    %eax,%edi
call   1040 <ROR8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op7EM1X0>:
push   %rax
mov    $0x3,%edi
call   1030 <AbsoluteIndexedXX0@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ROR8@plt>

LLVM IR (-O0):
define void @Op7EM1X0() {
%1 = call i32 @AbsoluteIndexedXX0(i32 3)
%2 = call i32 @ROR8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op7EM1X0() {
%1 = tail call i32 @AbsoluteIndexedXX0(i32 3)
%2 = tail call i32 @ROR8(i32 %1)
ret void
}
void lowlevel_init() {}


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

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

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

LLVM IR (-O2):
define void @lowlevel_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlcpy(char *, char const *, size_t);
size_t strlen(char *);
char *max_strncat(char *dest, const char *src, size_t n) {
  size_t len1 = strlen(dest);
  if (len1 < (n - 1))
    strlcpy(dest + len1, src, (n - 1) - len1);
  return dest;
}


x86 assembly (clang, -O0):
<max_strncat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    1173 <max_strncat+0x53>
mov    -0x8(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
sub    -0x20(%rbp),%rdx
call   1040 <strlcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_strncat>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0xffffffffffffffff,%rbx
sub    %rax,%rbx
jbe    114d <max_strncat+0x2d>
add    %r14,%rax
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <strlcpy@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @max_strncat(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %7
%10 = load i64, i64* %7
%11 = load i64, i64* %6
%12 = sub i64 %11, 1
%13 = icmp ult i64 %10, %12
br i1 %13, label %14, label %24
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i8*, i8** %5
%19 = load i64, i64* %6
%20 = sub i64 %19, 1
%21 = load i64, i64* %7
%22 = sub i64 %20, %21
%23 = call i32 @strlcpy(i8* %17, i8* %18, i64 %22)
br label %24
24: ; preds = %14, %3
%25 = load i8*, i8** %4
ret i8* %25
}

LLVM IR (-O2):
define i8* @max_strncat(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = add i64 %2, -1
%6 = icmp ugt i64 %5, %4
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 %4
%9 = sub i64 %5, %4
%10 = tail call i32 @strlcpy(i8* %8, i8* %1, i64 %9)
br label %11
11: ; preds = %7, %3
ret i8* %0
}
/* Type definitions */
typedef long long time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(long long *);
int /*<<< orphan*/ strftime(char *, size_t, char *, struct tm *);
char *tstostrf(char *buf, size_t len, long long ts, char *fmt) {
  time_t now = ts + 1262304000;
  struct tm uts = *localtime(&now);
  strftime(buf, len, fmt, &uts);
  return buf;
}


x86 assembly (clang, -O0):
<tstostrf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x4b3d3b00,%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1040 <strftime@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tstostrf>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
add    $0x4b3d3b00,%rdx
mov    %rdx,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i8* @tstostrf(i8* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca %struct.tm
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%11 = load i64, i64* %7
%12 = add nsw i64 %11, 1262304000
store i64 %12, i64* %9
%13 = call %struct.tm* @localtime(i64* %9)
%14 = bitcast %struct.tm* %10 to i8*
%15 = bitcast %struct.tm* %13 to i8*
%16 = load i8*, i8** %5
%17 = load i64, i64* %6
%18 = load i8*, i8** %8
%19 = call i32 @strftime(i8* %16, i64 %17, i8* %18, %struct.tm* %10)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i8* @tstostrf(i8* returned %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i64
%6 = alloca %struct.tm
%7 = bitcast i64* %5 to i8*
%8 = add nsw i64 %2, 1262304000
store i64 %8, i64* %5
%9 = bitcast %struct.tm* %6 to i8*
%10 = call %struct.tm* @localtime(i64* %5)
%11 = getelementptr %struct.tm, %struct.tm* %10, i64 0, i32 0
%12 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%13 = load i32, i32* %11
store i32 %13, i32* %12
%14 = call i32 @strftime(i8* %0, i64 %1, i8* %3, %struct.tm* %6)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello(void) { printf("Hello, library world.\n"); }


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

x86 assembly (clang, -O2):
<hello>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Hello, library world.\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"Hello, library world.\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, int /*<<< orphan*/);
void strcat_null_src(char *x) { strcat(x, 0); }


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

x86 assembly (clang, -O2):
<strcat_null_src>:
xor    %esi,%esi
jmp    1030 <strcat@plt>

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

LLVM IR (-O2):
define void @strcat_null_src(i8* %0) {
%2 = tail call i32 @strcat(i8* %0, i32 0)
ret void
}
int sub2(int a) { return (a - 3) != 0; }


x86 assembly (clang, -O0):
<sub2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub2>:
xor    %eax,%eax
cmp    $0x3,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @sub2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 3
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @sub2(i32 %0) {
%2 = icmp ne i32 %0, 3
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int flsnz(unsigned int);
int fls64(unsigned long long x) {
  unsigned int h;
  unsigned int bits = 32;
  h = x >> 32;
  if (!h) {
    h = x;
    bits = 0;
  }
  return flsnz(h) + bits;
}


x86 assembly (clang, -O0):
<fls64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x20,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1146 <fls64+0x36>
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <flsnz@plt>
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fls64>:
push   %rbx
xor    %ebx,%ebx
mov    %rdi,%rax
shr    $0x20,%rax
setne  %bl
cmovne %eax,%edi
shl    $0x5,%ebx
call   1030 <flsnz@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fls64(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i64 %0, i64* %2
store i32 32, i32* %4
%5 = load i64, i64* %2
%6 = lshr i64 %5, 32
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %1
%11 = load i64, i64* %2
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
store i32 0, i32* %4
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
%15 = call i32 @flsnz(i32 %14)
%16 = load i32, i32* %4
%17 = add i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @fls64(i64 %0) {
%2 = lshr i64 %0, 32
%3 = trunc i64 %2 to i32
%4 = icmp eq i32 %3, 0
%5 = trunc i64 %0 to i32
%6 = select i1 %4, i32 %5, i32 %3
%7 = select i1 %4, i32 0, i32 32
%8 = tail call i32 @flsnz(i32 %6)
%9 = add i32 %8, %7
ret i32 %9
}
void rotr(int *a, int *b, int *c) {
  int temp;
  temp = *b;
  *b = *c;
  *c = temp;
  temp = *a;
  *a = *b;
  *b = temp;
}


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

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

LLVM IR (-O0):
define void @rotr(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** %5
%9 = load i32, i32* %8
store i32 %9, i32* %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = load i32*, i32** %5
store i32 %11, i32* %12
%13 = load i32, i32* %7
%14 = load i32*, i32** %6
store i32 %13, i32* %14
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
store i32 %16, i32* %7
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
store i32 %18, i32* %19
%20 = load i32, i32* %7
%21 = load i32*, i32** %5
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
define void @rotr(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = load i32, i32* %2
store i32 %5, i32* %1
store i32 %4, i32* %2
%6 = load i32, i32* %0
%7 = load i32, i32* %1
store i32 %7, i32* %0
store i32 %6, i32* %1
ret void
}
void __attribute__((no)) ox_ctrl_2(int *k) { *k = 8; }


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

x86 assembly (clang, -O2):
<ox_ctrl_2>:
movl   $0x8,(%rdi)
ret

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

LLVM IR (-O2):
define void @ox_ctrl_2(i32* nocapture writeonly %0) {
store i32 8, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printFileContent(char *);
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  printFileContent(filename);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <printFileContent@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <printFileContent@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @printFileContent(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printFileContent(i8* %4)
ret i32 0
}
double *am_malloc_realnums(int size) {
  double *result = ((double *)malloc((size) * sizeof(double)));
  set_realnums_constant(result, size, -7.7777e27);
  return (result);
}


x86 assembly (clang, -O0):
<am_malloc_realnums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
movsd  0xeb5(%rip),%xmm0
mov    $0x1,%al
call   1030 <set_realnums_constant@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<am_malloc_realnums>:
push   %r14
push   %rbx
push   %rax
movslq %edi,%r14
lea    0x0(,%r14,8),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
movsd  0xec1(%rip),%xmm0
mov    %rax,%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1030 <set_realnums_constant@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @am_malloc_realnums(i32 %0) {
%2 = alloca i32
%3 = alloca double*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 8
%7 = call i8* @malloc(i64 %6)
%8 = bitcast i8* %7 to double*
store double* %8, double** %3
%9 = load double*, double** %3
%10 = load i32, i32* %2
%11 = call i32 (double*, i32, double, ...) bitcast (i32 (...)* @set_realnums_constant to i32 (double*, i32, double, ...)*)(double* %9, i32 %10, double -7.777700e+27)
%12 = load double*, double** %3
ret double* %12
}

LLVM IR (-O2):
define double* @am_malloc_realnums(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl nsw i64 %2, 3
%4 = tail call i8* @malloc(i64 %3)
%5 = bitcast i8* %4 to double*
%6 = tail call i32 (double*, i32, double, ...) bitcast (i32 (...)* @set_realnums_constant to i32 (double*, i32, double, ...)*)(double* %5, i32 %0, double -7.777700e+27)
ret double* %5
}
/* Variables and functions */
int /*<<< orphan*/ cgincbloc(char *, int, int);
void cginclb(int a) { cgincbloc("add", a, 1); }


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

x86 assembly (clang, -O2):
<cginclb>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
mov    $0x1,%edx
jmp    1030 <cgincbloc@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
define void @cginclb(i32 %0) {
%2 = tail call i32 @cgincbloc(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0, i32 1)
ret void
}
void arch_reset(char mode) {
  *(unsigned long *)0 = *(unsigned long *)0x03800000;
  ((void (*)(void))0)();
}


x86 assembly (clang, -O0):
<arch_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x3800000,%eax
mov    (%rax),%rcx
xor    %eax,%eax
mov    %rcx,(%rax)
xor    %eax,%eax
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @arch_reset(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i64, i64* inttoptr (i64 58720256 to i64*)
store i64 %3, i64* null
ret void
}

LLVM IR (-O2):
void pointer_to_integral_type_conv(char *ptr) {
  char ch = (char)ptr;
  short sh = (short)ptr;
  ch = (char)ptr;
  sh = (short)ptr;
  _Bool b = (_Bool)ptr;
}


x86 assembly (clang, -O0):
<pointer_to_integral_type_conv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %ax,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
mov    %al,-0xd(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @pointer_to_integral_type_conv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i16
%5 = alloca i8
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = ptrtoint i8* %6 to i8
store i8 %7, i8* %3
%8 = load i8*, i8** %2
%9 = ptrtoint i8* %8 to i16
store i16 %9, i16* %4
%10 = load i8*, i8** %2
%11 = ptrtoint i8* %10 to i8
store i8 %11, i8* %3
%12 = load i8*, i8** %2
%13 = ptrtoint i8* %12 to i16
store i16 %13, i16* %4
%14 = load i8*, i8** %2
%15 = icmp ne i8* %14, null
%16 = zext i1 %15 to i8
store i8 %16, i8* %5
ret void
}

LLVM IR (-O2):
define void @pointer_to_integral_type_conv(i8* nocapture %0) {
ret void
}
int strcmp(char *s1, char *s2) {
  while (*s1 == *s2) {
    if (!*s1)
      return 0;
    ++s1;
    ++s2;
  }
  return ((unsigned char)*s1) - ((unsigned char)*s2);
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1158 <strcmp+0x58>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    113b <strcmp+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    116b <strcmp+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
mov    (%rsi),%cl
cmp    %cl,%al
jne    1124 <strcmp+0x24>
mov    $0x1,%edx
nopl   (%rax)
test   %al,%al
je     112d <strcmp+0x2d>
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
add    $0x1,%rdx
cmp    %cl,%al
je     1110 <strcmp+0x10>
movzbl %al,%eax
movzbl %cl,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2, %11
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = phi i8* [ %13, %11 ], [ %1, %2 ]
%9 = phi i8* [ %12, %11 ], [ %0, %2 ]
%10 = icmp eq i8 %7, 0
br i1 %10, label %23, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %12
%15 = load i8, i8* %13
%16 = icmp eq i8 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %11, %2
%18 = phi i8 [ %3, %2 ], [ %14, %11 ]
%19 = phi i8 [ %4, %2 ], [ %15, %11 ]
%20 = zext i8 %18 to i32
%21 = zext i8 %19 to i32
%22 = sub nsw i32 %20, %21
br label %23
23: ; preds = %6, %17
%24 = phi i32 [ %22, %17 ], [ 0, %6 ]
ret i32 %24
}
/* Variables and functions */
int /*<<< orphan*/ UnityPrint(char *);
void UnityPrintFail(void) { UnityPrint("FAIL"); }


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

x86 assembly (clang, -O2):
<UnityPrintFail>:
lea    0xee9(%rip),%rdi
jmp    1030 <UnityPrint@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"FAIL\00"
define void @UnityPrintFail() {
%1 = call i32 @UnityPrint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"FAIL\00"
define void @UnityPrintFail() {
%1 = tail call i32 @UnityPrint(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MSG_BoxedText(char *);
int /*<<< orphan*/ printf(char *);
void MSG_Plain_Header(char *title, char *msg) {
  printf("\n");
  MSG_BoxedText(title);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<MSG_Plain_Header>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <MSG_BoxedText@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @MSG_Plain_Header(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @MSG_BoxedText(i8* %0)
%5 = tail call i32 @putchar(i32 10)
ret void
}
void add_disk(struct gendisk *disk) { return; }


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

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

LLVM IR (-O0):
%struct.gendisk = type opaque
define void @add_disk(%struct.gendisk* %0) {
%2 = alloca %struct.gendisk*
store %struct.gendisk* %0, %struct.gendisk** %2
ret void
}

LLVM IR (-O2):
%struct.gendisk = type opaque
define void @add_disk(%struct.gendisk* nocapture %0) {
ret void
}
float sqrt1(const float x) {
  const float xhalf = 0.5f * x;
  union {
    float x;
    int i;
  } u;
  u.x = x;
  u.i = 0x5f3759df - (u.i >> 1);
  return x * u.x * (1.5f - xhalf * u.x * u.x);
}


x86 assembly (clang, -O0):
<sqrt1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe99(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrt1>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
movdqa %xmm1,%xmm2
mulss  %xmm0,%xmm2
mulss  0xedf(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xed3(%rip),%xmm0
mulss  %xmm2,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @sqrt1(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca %union.anon
store float %0, float* %2
%5 = load float, float* %2
%6 = fmul float 5.000000e-01, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = bitcast %union.anon* %4 to float*
store float %7, float* %8
%9 = bitcast %union.anon* %4 to i32*
%10 = load i32, i32* %9
%11 = ashr i32 %10, 1
%12 = sub nsw i32 1597463007, %11
%13 = bitcast %union.anon* %4 to i32*
store i32 %12, i32* %13
%14 = load float, float* %2
%15 = bitcast %union.anon* %4 to float*
%16 = load float, float* %15
%17 = fmul float %14, %16
%18 = load float, float* %3
%19 = bitcast %union.anon* %4 to float*
%20 = load float, float* %19
%21 = fmul float %18, %20
%22 = bitcast %union.anon* %4 to float*
%23 = load float, float* %22
%24 = fneg float %21
%25 = call float @llvm.fmuladd.f32(float %24, float %23, float 1.500000e+00)
%26 = fmul float %17, %25
ret float %26
}

LLVM IR (-O2):
define float @sqrt1(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463007, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %5, %0
%7 = fmul float %0, -5.000000e-01
%8 = fmul float %7, %5
%9 = tail call float @llvm.fmuladd.f32(float %8, float %5, float 1.500000e+00)
%10 = fmul float %6, %9
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_vi1();
int /*<<< orphan*/ take_struct_vi1(int /*<<< orphan*/);
void test_struct_vi1() { take_struct_vi1(return_struct_vi1()); }


x86 assembly (clang, -O0):
<test_struct_vi1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_vi1@plt>
mov    %eax,%edi
call   1030 <take_struct_vi1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_vi1>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_vi1@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_vi1@plt>

LLVM IR (-O0):
define void @test_struct_vi1() {
%1 = call i32 (...) @return_struct_vi1()
%2 = call i32 @take_struct_vi1(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_vi1() {
%1 = tail call i32 (...) @return_struct_vi1()
%2 = tail call i32 @take_struct_vi1(i32 %1)
ret void
}
float frand(void) {
  static unsigned x = 123456789, y = 362436069, z = 521288629, w = 88675123;
  unsigned t = x ^ x << 11;
  x = y;
  y = z;
  z = w;
  w ^= w >> 19 ^ t ^ t >> 8;
  return (float)(w * (1.0 / 4294967296.0));
}


x86 assembly (clang, -O0):
<frand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
mov    %eax,%ecx
shl    $0xb,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    0x2f0a(%rip),%eax
mov    %eax,0x2f00(%rip)
mov    0x2f02(%rip),%eax
mov    %eax,0x2ef8(%rip)
mov    0x2efa(%rip),%eax
mov    %eax,0x2ef0(%rip)
mov    0x2eee(%rip),%eax
mov    %eax,%ecx
shr    $0x13,%ecx
mov    -0x4(%rbp),%edx
xor    %edx,%ecx
shr    $0x8,%edx
xor    %edx,%ecx
xor    %ecx,%eax
mov    %eax,0x2ed7(%rip)
mov    0x2ed1(%rip),%eax
cvtsi2sd %rax,%xmm0
movsd  0xe98(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<frand>:
mov    0x2f1a(%rip),%eax
mov    %eax,%ecx
shl    $0xb,%ecx
xor    %eax,%ecx
mov    0x2f11(%rip),%eax
mov    %eax,0x2f07(%rip)
mov    0x2f09(%rip),%eax
mov    %eax,0x2eff(%rip)
mov    0x2f01(%rip),%eax
mov    %eax,0x2ef7(%rip)
mov    %ecx,%edx
shr    $0x8,%edx
xor    %eax,%ecx
shr    $0x13,%eax
xor    %edx,%ecx
xor    %eax,%ecx
mov    %ecx,0x2ee7(%rip)
cvtsi2sd %rcx,%xmm0
mulsd  0xeae(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
@frand.x = internal global i32 123456789
@frand.y = internal global i32 362436069
@frand.z = internal global i32 521288629
@frand.w = internal global i32 88675123
define float @frand() {
%1 = alloca i32
%2 = load i32, i32* @frand.x
%3 = load i32, i32* @frand.x
%4 = shl i32 %3, 11
%5 = xor i32 %2, %4
store i32 %5, i32* %1
%6 = load i32, i32* @frand.y
store i32 %6, i32* @frand.x
%7 = load i32, i32* @frand.z
store i32 %7, i32* @frand.y
%8 = load i32, i32* @frand.w
store i32 %8, i32* @frand.z
%9 = load i32, i32* @frand.w
%10 = lshr i32 %9, 19
%11 = load i32, i32* %1
%12 = xor i32 %10, %11
%13 = load i32, i32* %1
%14 = lshr i32 %13, 8
%15 = xor i32 %12, %14
%16 = load i32, i32* @frand.w
%17 = xor i32 %16, %15
store i32 %17, i32* @frand.w
%18 = load i32, i32* @frand.w
%19 = uitofp i32 %18 to double
%20 = fmul double %19, 0x3DF0000000000000
%21 = fptrunc double %20 to float
ret float %21
}

LLVM IR (-O2):
@frand.x = internal unnamed_addr global i32 123456789
@frand.y = internal unnamed_addr global i32 362436069
@frand.z = internal unnamed_addr global i32 521288629
@frand.w = internal unnamed_addr global i32 88675123
define float @frand() {
%1 = load i32, i32* @frand.x
%2 = shl i32 %1, 11
%3 = xor i32 %2, %1
%4 = load i32, i32* @frand.y
store i32 %4, i32* @frand.x
%5 = load i32, i32* @frand.z
store i32 %5, i32* @frand.y
%6 = load i32, i32* @frand.w
store i32 %6, i32* @frand.z
%7 = lshr i32 %6, 19
%8 = lshr i32 %3, 8
%9 = xor i32 %8, %3
%10 = xor i32 %9, %6
%11 = xor i32 %10, %7
store i32 %11, i32* @frand.w
%12 = uitofp i32 %11 to double
%13 = fmul double %12, 0x3DF0000000000000
%14 = fptrunc double %13 to float
ret float %14
}