xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dziwneFor(int tab[], int size) {
  int i;
  for (i = 0; i < size;)
    printf("%d ", tab[i++]);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<dziwneFor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <dziwneFor+0x4a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1126 <dziwneFor+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dziwneFor>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <dziwneFor+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
add    $0x1,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %rbx,%r12
jne    1140 <dziwneFor+0x20>
lea    0xea6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@str = [2 x i8] c"\0A\00"
define void @dziwneFor(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %8, %6 ]
%8 = add nuw nsw i64 %7, 1
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp eq i64 %8, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
int test_imm_A6int8_reg(signed char val) {
  return ((val) & (0xA6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A6int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xa6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_A6int8_reg(i8 signext %0) {
%2 = and i8 %0, -90
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void glBlitFramebuffer(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glBlitFramebuffer() {
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef scalar_t__ p;

/* Variables and functions */
scalar_t__ ntohl(int /*<<< orphan*/ const);
uint64_t EXTRACT_64BITS(const void *p) {
  return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 |
                     ((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0));
}


x86 assembly (clang, -O0):
<EXTRACT_64BITS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <ntohl@plt>
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <ntohl@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
shl    $0x0,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EXTRACT_64BITS>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <ntohl@plt>
mov    0x4(%rbx),%edi
pop    %rbx
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @EXTRACT_64BITS(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = call i64 @ntohl(i32 %6)
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 32
%10 = load i8*, i8** %2
%11 = bitcast i8* %10 to i32*
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = call i64 @ntohl(i32 %13)
%15 = trunc i64 %14 to i32
%16 = shl i32 %15, 0
%17 = or i32 %9, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @EXTRACT_64BITS(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i64 @ntohl(i32 %3)
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = tail call i64 @ntohl(i32 %7)
ret i32 poison
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double ohmd_get_tick() {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (double)now.tv_sec * 1.0 + (double)now.tv_usec / 1000000.0;
}


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

x86 assembly (clang, -O2):
<ohmd_get_tick>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @ohmd_get_tick() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = fdiv double %8, 1.000000e+06
%10 = call double @llvm.fmuladd.f64(double %5, double 1.000000e+00, double %9)
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @ohmd_get_tick() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %6
ret double %11
}
int pthread_getconcurrency() { return 0; }


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

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

LLVM IR (-O0):
define i32 @pthread_getconcurrency() {
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_getconcurrency() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_arm_wsr64(char *, unsigned long);
void wsr64(unsigned long v) { __builtin_arm_wsr64("1:2:3:4:5", v); }


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"1:2:3:4:5\00"
define void @wsr64(i64 %0) {
%2 = tail call i32 @__builtin_arm_wsr64(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
/* Type definitions */
struct bext {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct bext *);
struct bext *free_bext(struct bext **b) {
  if (*b == NULL)
    return NULL;
  free(*b);
  *b = NULL;
  return *b;
}


x86 assembly (clang, -O0):
<free_bext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1137 <free_bext+0x27>
movq   $0x0,-0x8(%rbp)
jmp    1159 <free_bext+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_bext>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <free_bext+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.bext = type { i32 }
define noalias %struct.bext* @free_bext(%struct.bext** nocapture %0) {
%2 = load %struct.bext*, %struct.bext** %0
%3 = icmp eq %struct.bext* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(%struct.bext* %2)
store %struct.bext* null, %struct.bext** %0
br label %6
6: ; preds = %1, %4
ret %struct.bext* null
}
int myread(fd, ptr, size)
int fd, size;
char *ptr;
{
  int result = read(fd, ptr, size);
  if (result < 0)
    perror_with_exit("Read failed");
  return result;
}


x86 assembly (clang, -O0):
<myread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    115e <myread+0x3e>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <perror_with_exit@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myread>:
push   %rbx
xor    %eax,%eax
call   1030 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    113c <myread+0x1c>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <perror_with_exit@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Read failed\00"
define i32 @myread(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i32, ...)*)(i32 %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @perror_with_exit to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
@.str = [12 x i8] c"Read failed\00"
define i32 @myread(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror_with_exit to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
void pipe_error() { perror("pipe error"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"pipe error\00"
define void @pipe_error() {
%1 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"pipe error\00"
define void @pipe_error() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int O_RDONLY;
int o_rdonly() { return O_RDONLY; }


x86 assembly (clang, -O0):
<o_rdonly>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<o_rdonly>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @o_rdonly() {
%1 = load i32, i32* @O_RDONLY
ret i32 %1
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @o_rdonly() {
%1 = load i32, i32* @O_RDONLY
ret i32 %1
}
/* Variables and functions */
int isDigit(char const *, int *);
int isDigit10(const char *c, int *value) { return isDigit(c, value); }


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

x86 assembly (clang, -O2):
<isDigit10>:
jmp    1030 <isDigit@plt>

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

LLVM IR (-O2):
define i32 @isDigit10(i8* %0, i32* %1) {
%3 = tail call i32 @isDigit(i8* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void boo(int const *p) {
  printf("= Aufgabe 18.2 =\n");
  int x = 20;
  p = &x;
  printf("const int p => %d\n", *p);
}


x86 assembly (clang, -O0):
<boo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x14,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boo>:
push   %rax
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"= Aufgabe 18.2 =\0A\00"
@.str.1 = [19 x i8] c"const int p => %d\0A\00"
define void @boo(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 20, i32* %3
store i32* %3, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"const int p => %d\0A\00"
@str = [17 x i8] c"= Aufgabe 18.2 =\00"
define void @boo(i32* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 20)
ret void
}
extern __attribute__((gnu_)) double carmen_radians_to_degrees(double theta) {
  return (theta * 180.0 / 3.14159265358979323846);
}


x86 assembly (clang, -O0):
<carmen_radians_to_degrees>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_radians_to_degrees>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @carmen_radians_to_degrees(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.800000e+02
%5 = fdiv double %4, 0x400921FB54442D18
ret double %5
}

LLVM IR (-O2):
define double @carmen_radians_to_degrees(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = fdiv double %2, 0x400921FB54442D18
ret double %3
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *stralloc(const char *string) {
  char *copy;
  copy = malloc(strlen(string) + 1);
  if (copy == NULL)
    return NULL;
  strcpy(copy, string);
  return copy;
}


x86 assembly (clang, -O0):
<stralloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <stralloc+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <stralloc+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stralloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <stralloc+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @stralloc(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %1, %6
ret i8* %4
}
/* Type definitions */
struct timeval {
  int dummy;
};
struct prof {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sprofil(struct prof *profp, int profcnt, struct timeval *tvp,
              unsigned int flags) {
  if (profcnt == 0)
    return 0;
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sprofil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113c <__sprofil+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1151 <__sprofil+0x41>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sprofil>:
test   %esi,%esi
je     112d <__sprofil+0x1d>
push   %rax
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.prof = type { i32 }
%struct.timeval = type { i32 }
@ENOSYS = global i32 0
define i32 @__sprofil(%struct.prof* %0, i32 %1, %struct.timeval* %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.prof*
%7 = alloca i32
%8 = alloca %struct.timeval*
%9 = alloca i32
store %struct.prof* %0, %struct.prof** %6
store i32 %1, i32* %7
store %struct.timeval* %2, %struct.timeval** %8
store i32 %3, i32* %9
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %4
store i32 0, i32* %5
br label %16
13: ; preds = %4
%14 = load i32, i32* @ENOSYS
%15 = call i32 @__set_errno(i32 %14)
store i32 -1, i32* %5
br label %16
16: ; preds = %13, %12
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
%struct.prof = type { i32 }
%struct.timeval = type { i32 }
@ENOSYS = global i32 0
define i32 @__sprofil(%struct.prof* nocapture readnone %0, i32 %1, %struct.timeval* nocapture readnone %2, i32 %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = load i32, i32* @ENOSYS
%8 = tail call i32 @__set_errno(i32 %7)
br label %9
9: ; preds = %4, %6
%10 = phi i32 [ -1, %6 ], [ 0, %4 ]
ret i32 %10
}
/* Variables and functions */
scalar_t__ pause();
void *dummy_thread_fn(void *arg) { return (void *)(size_t)pause(); }


x86 assembly (clang, -O0):
<dummy_thread_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <pause@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @dummy_thread_fn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @pause()
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}

LLVM IR (-O2):
define i8* @dummy_thread_fn(i8* nocapture readnone %0) {
%2 = tail call i64 (...) @pause()
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_IFDIR;
int S_IFMT;
int file_directory(const struct stat *stat) {
  return (stat->st_mode & S_IFMT) != S_IFDIR;
}


x86 assembly (clang, -O0):
<file_directory>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2ecb(%rip),%rcx
and    (%rcx),%eax
mov    0x2eb2(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_directory>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
and    (%rdi),%ecx
mov    0x2ebe(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
setne  %al
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IFMT = global i32 0
@S_IFDIR = global i32 0
define i32 @file_directory(%struct.stat* %0) {
%2 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %2
%3 = load %struct.stat*, %struct.stat** %2
%4 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @S_IFMT
%7 = and i32 %5, %6
%8 = load i32, i32* @S_IFDIR
%9 = icmp ne i32 %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFMT = global i32 0
@S_IFDIR = global i32 0
define i32 @file_directory(%struct.stat* nocapture %0) {
%2 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @S_IFMT
%5 = and i32 %4, %3
%6 = load i32, i32* @S_IFDIR
%7 = icmp ne i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int n = 0;
  int a = 1 << 32;
  int b = 1 << (n + 32);
  assert(a == 0);
  assert(b == 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    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
add    $0x20,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <assert@plt>
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 poison, i32* %3
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 32
%7 = shl i32 1, %6
store i32 %7, i32* %4
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 poison)
%2 = tail call i32 @assert(i32 poison)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ runtime_exit();
void exit(int status) {
  printf("Exit called with %d\n", status);
  runtime_exit();
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <runtime_exit@plt>

x86 assembly (clang, -O2):
<exit>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <runtime_exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Exit called with %d\0A\00"
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @runtime_exit()
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"Exit called with %d\0A\00"
define void @exit(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @runtime_exit()
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
void close_database(sqlite3 *db) { sqlite3_close(db); }


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

x86 assembly (clang, -O2):
<close_database>:
jmp    1030 <sqlite3_close@plt>

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

LLVM IR (-O2):
define void @close_database(i32* %0) {
%2 = tail call i32 @sqlite3_close(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void __attribute__((no)) foo_s64(long long a, long long b) {
  if (a == -b)
    abort();
}


x86 assembly (clang, -O0):
<foo_s64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jne    113a <foo_s64+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_s64>:
add    %rsi,%rdi
je     1116 <foo_s64+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @foo_s64(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 0, %6
%8 = icmp eq i64 %5, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @foo_s64(i64 %0, i64 %1) {
%3 = sub nsw i64 0, %1
%4 = icmp eq i64 %3, %0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret void
}
int sum_upto(int n) {
  int i;
  int retval = 0;
  for (i = 1; i <= n; ++i)
    retval += i;
  return retval;
}


x86 assembly (clang, -O0):
<sum_upto>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <sum_upto+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <sum_upto+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum_upto>:
test   %edi,%edi
jle    1118 <sum_upto+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sum_upto(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ json_value_free(void *);
void map_post_func_2(void *data) { json_value_free(data); }


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

x86 assembly (clang, -O2):
<map_post_func_2>:
jmp    1030 <json_value_free@plt>

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

LLVM IR (-O2):
define void @map_post_func_2(i8* %0) {
%2 = tail call i32 @json_value_free(i8* %0)
ret void
}
void external_observer(unsigned x) { asm __volatile__("# %0" ::"r"(x)); }


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

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

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

LLVM IR (-O2):
define void @external_observer(i32 %0) {
tail call void asm sideeffect "# $0", "r,~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret void
}
void g_ucs4_to_utf8() {}


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

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

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

LLVM IR (-O2):
define void @g_ucs4_to_utf8() {
ret void
}
void print_version(void) {}


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

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

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

LLVM IR (-O2):
define void @print_version() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ata_get_string(unsigned char const *, int, int, char *);
void ata_get_ata_identify_current_media_serial(const unsigned char *buf,
                                               char *out) {
  ata_get_string(buf, 176, 205, out);
}


x86 assembly (clang, -O0):
<ata_get_ata_identify_current_media_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xb0,%esi
mov    $0xcd,%edx
call   1030 <ata_get_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ata_get_ata_identify_current_media_serial>:
mov    %rsi,%rcx
mov    $0xb0,%esi
mov    $0xcd,%edx
jmp    1030 <ata_get_string@plt>

LLVM IR (-O0):
define void @ata_get_ata_identify_current_media_serial(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @ata_get_string(i8* %5, i32 176, i32 205, i8* %6)
ret void
}

LLVM IR (-O2):
define void @ata_get_ata_identify_current_media_serial(i8* %0, i8* %1) {
%3 = tail call i32 @ata_get_string(i8* %0, i32 176, i32 205, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void help(void) {
  printf("usage: %s\n"
         "  -h, --help           show this help\n"
         "  -c, --config <file>  config file\n"
         "  -d, --daemon         daemonize after initialization\n"
         "  --pidfile <file>     PID file\n"
         "  --logfile <file>     log file\n"
         "  -V, --version        print version and exit\n\n"
         "Bug report: <%s>.\n",
         "muon", "https://github.com/puxxustc/muon/issues");
}


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

x86 assembly (clang, -O2):
<help>:
lea    0xee9(%rip),%rdi
lea    0xfed(%rip),%rsi
lea    0xfeb(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [267 x i8] c"usage: %s\0A -h, --help show this help\0A -c, --config <file> config file\0A -d, --daemon daemonize after initialization\0A --pidfile <file> PID file\0A --logfile <file> log file\0A -V, --version print version and exit\0A\0ABug report: <%s>.\0A\00"
@.str.1 = [5 x i8] c"muon\00"
@.str.2 = [40 x i8] c"https://github.com/puxxustc/muon/issues\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([267 x i8], [267 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [267 x i8] c"usage: %s\0A -h, --help show this help\0A -c, --config <file> config file\0A -d, --daemon daemonize after initialization\0A --pidfile <file> PID file\0A --logfile <file> log file\0A -V, --version print version and exit\0A\0ABug report: <%s>.\0A\00"
@.str.1 = [5 x i8] c"muon\00"
@.str.2 = [40 x i8] c"https://github.com/puxxustc/muon/issues\00"
define void @help() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([267 x i8], [267 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("Usage:\n");
  printf("    ./main [FILE]\n");
  printf("where FILE is the file for TOPL to interpret\n");
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [19 x i8] c" ./main [FILE]\0A\00"
@.str.2 = [46 x i8] c"where FILE is the file for TOPL to interpret\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.3 = [18 x i8] c" ./main [FILE]\00"
@str.4 = [45 x i8] c"where FILE is the file for TOPL to interpret\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *_ITM_malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *tanger_stm_calloc(size_t nmemb, size_t size) {
  void *p = _ITM_malloc(nmemb * size);
  memset(p, 0, nmemb * size);
  return p;
}


x86 assembly (clang, -O0):
<tanger_stm_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
call   1040 <_ITM_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
imul   -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanger_stm_calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <_ITM_malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @tanger_stm_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = mul i64 %6, %7
%9 = call i8* @_ITM_malloc(i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = mul i64 %11, %12
%14 = call i32 @memset(i8* %10, i32 0, i64 %13)
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
define i8* @tanger_stm_calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @_ITM_malloc(i64 %3)
%5 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
ret i8* %4
}
void do_work(int seconds) {
  int __attribute__((unused)) i, j;
  for (int i = 0; i < 1000000; i++) {
    for (int j = 0; j < 1000000; j++) {
    }
  }
}


x86 assembly (clang, -O0):
<do_work>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xf4240,-0x10(%rbp)
jge    1155 <do_work+0x55>
movl   $0x0,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
jge    1142 <do_work+0x42>
jmp    1134 <do_work+0x34>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1122 <do_work+0x22>
jmp    1147 <do_work+0x47>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    110e <do_work+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @do_work(i32 %0) {
ret void
}
void wincon_() {}


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

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

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

LLVM IR (-O2):
define void @wincon_() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ stderr;
void create_layouts_directory() {
  if (mkdir("_layouts", 0770) != 0) {
    fprintf(stderr, "ERROR: Could not create _layouts directory\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<create_layouts_directory>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
mov    $0x1f8,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     1172 <create_layouts_directory+0x42>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_layouts_directory>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0x1f8,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    1149 <create_layouts_directory+0x19>
pop    %rax
ret
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"_layouts\00"
@stderr = global i32 0
@.str.1 = [44 x i8] c"ERROR: Could not create _layouts directory\0A\00"
@EXIT_FAILURE = global i32 0
define void @create_layouts_directory() {
%1 = call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 504)
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"_layouts\00"
@stderr = global i32 0
@.str.1 = [44 x i8] c"ERROR: Could not create _layouts directory\0A\00"
@EXIT_FAILURE = global i32 0
define void @create_layouts_directory() {
%1 = tail call i64 @mkdir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 504)
%2 = icmp eq i64 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int);
void get_rev_path(int nro_rev, char *index_path, char *result) {
  sprintf(result, "%s/%s/.%d", index_path, ".index", nro_rev);
}


x86 assembly (clang, -O0):
<get_rev_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x4(%rbp),%r8d
lea    0xeca(%rip),%rsi
lea    0xecd(%rip),%rcx
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rev_path>:
mov    %rdx,%rax
mov    %rsi,%rdx
mov    %edi,%r8d
lea    0xee0(%rip),%rsi
lea    0xee3(%rip),%rcx
mov    %rax,%rdi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"%s/%s/.%d\00"
@.str.1 = [7 x i8] c".index\00"
define void @get_rev_path(i32 %0, i8* %1, i8* nocapture writeonly %2) {
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f();
main() {
  f();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <f@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @f()
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int t();
void q() {
  int i = t();
  if (!i)
    i = t();
}


x86 assembly (clang, -O0):
<q>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <t@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1136 <q+0x26>
mov    $0x0,%al
call   1030 <t@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q>:
push   %rax
xor    %eax,%eax
call   1030 <t@plt>
test   %eax,%eax
je     111e <q+0xe>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <t@plt>

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

LLVM IR (-O2):
define void @q() {
%1 = tail call i32 (...) @t()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @t()
br label %5
5: ; preds = %3, %0
ret void
}