#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct crypt_options {
  int dummy;
};
struct crypt_device {
  int dummy;
};

/* Variables and functions */
int _crypt_init(struct crypt_device **, char *, struct crypt_options *, int,
                int /*<<< orphan*/);
int /*<<< orphan*/ crypt_free(struct crypt_device *);
scalar_t__ crypt_get_uuid(struct crypt_device *);
int /*<<< orphan*/ logger(struct crypt_device *, int /*<<< orphan*/, char *,
                          int, char *);
int crypt_luksUUID(struct crypt_options *options) {
  struct crypt_device *cd = NULL;
  char *uuid;
  int r;
  r = _crypt_init(&cd, "LUKS1", options, 1, 0);
  if (r)
    return r;
  uuid = (char *)crypt_get_uuid(cd);
  logger(cd, 0,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/"
         "refs/heads/master/lib/setup.c",
         922, uuid ?: "");
  logger(cd, 0,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/"
         "refs/heads/master/lib/setup.c",
         923, "\n");
  crypt_free(cd);
  return 0;
}


x86 assembly (clang, -O0):
<crypt_luksUUID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1040 <_crypt_init@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1188 <crypt_luksUUID+0x48>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1215 <crypt_luksUUID+0xd5>
mov    -0x18(%rbp),%rdi
call   1030 <crypt_get_uuid@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     11bc <crypt_luksUUID+0x7c>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    11cc <crypt_luksUUID+0x8c>
lea    0xee7(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    11cc <crypt_luksUUID+0x8c>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%r8
xor    %esi,%esi
lea    0xe29(%rip),%rdx
mov    $0x39a,%ecx
call   1060 <logger@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
lea    0xe12(%rip),%rdx
mov    $0x39b,%ecx
lea    0xea9(%rip),%r8
call   1060 <logger@plt>
mov    -0x18(%rbp),%rdi
call   1050 <crypt_free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt_luksUUID>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rdx
movq   $0x0,(%rsp)
lea    0xeaa(%rip),%rsi
mov    %rsp,%rdi
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1040 <_crypt_init@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    11c0 <crypt_luksUUID+0x80>
mov    (%rsp),%rdi
call   1030 <crypt_get_uuid@plt>
mov    (%rsp),%rdi
test   %rax,%rax
lea    0xf27(%rip),%r8
cmovne %rax,%r8
lea    0xe78(%rip),%r14
xor    %esi,%esi
mov    %r14,%rdx
mov    $0x39a,%ecx
call   1060 <logger@plt>
mov    (%rsp),%rdi
lea    0xf01(%rip),%r8
xor    %esi,%esi
mov    %r14,%rdx
mov    $0x39b,%ecx
call   1060 <logger@plt>
mov    (%rsp),%rdi
call   1050 <crypt_free@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.crypt_options = type { i32 }
%struct.crypt_device = type { i32 }
@.str = [6 x i8] c"LUKS1\00"
@.str.1 = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/refs/heads/master/lib/setup.c\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\0A\00"
define i32 @crypt_luksUUID(%struct.crypt_options* %0) {
%2 = alloca i32
%3 = alloca %struct.crypt_options*
%4 = alloca %struct.crypt_device*
%5 = alloca i8*
%6 = alloca i32
store %struct.crypt_options* %0, %struct.crypt_options** %3
store %struct.crypt_device* null, %struct.crypt_device** %4
%7 = load %struct.crypt_options*, %struct.crypt_options** %3
%8 = call i32 @_crypt_init(%struct.crypt_device** %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %struct.crypt_options* %7, i32 1, i32 0)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i32, i32* %6
store i32 %12, i32* %2
br label %29
13: ; preds = %1
%14 = load %struct.crypt_device*, %struct.crypt_device** %4
%15 = call i64 @crypt_get_uuid(%struct.crypt_device* %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %5
%17 = load %struct.crypt_device*, %struct.crypt_device** %4
%18 = load i8*, i8** %5
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %21
20: ; preds = %13
br label %22
21: ; preds = %13
br label %22
22: ; preds = %21, %20
%23 = phi i8* [ %18, %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %21 ]
%24 = call i32 @logger(%struct.crypt_device* %17, i32 0, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 922, i8* %23)
%25 = load %struct.crypt_device*, %struct.crypt_device** %4
%26 = call i32 @logger(%struct.crypt_device* %25, i32 0, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 923, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = load %struct.crypt_device*, %struct.crypt_device** %4
%28 = call i32 @crypt_free(%struct.crypt_device* %27)
store i32 0, i32* %2
br label %29
29: ; preds = %22, %11
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
%struct.crypt_options = type { i32 }
%struct.crypt_device = type { i32 }
@.str = [6 x i8] c"LUKS1\00"
@.str.1 = [163 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/SteamMOD/android_bootable_steam_cryptsetup/refs/heads/master/lib/setup.c\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\0A\00"
define i32 @crypt_luksUUID(%struct.crypt_options* %0) {
%2 = alloca %struct.crypt_device*
%3 = bitcast %struct.crypt_device** %2 to i8*
store %struct.crypt_device* null, %struct.crypt_device** %2
%4 = call i32 @_crypt_init(%struct.crypt_device** %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %struct.crypt_options* %0, i32 1, i32 0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = load %struct.crypt_device*, %struct.crypt_device** %2
%8 = call i64 @crypt_get_uuid(%struct.crypt_device* %7)
%9 = inttoptr i64 %8 to i8*
%10 = load %struct.crypt_device*, %struct.crypt_device** %2
%11 = icmp eq i64 %8, 0
%12 = select i1 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %9
%13 = call i32 @logger(%struct.crypt_device* %10, i32 0, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 922, i8* %12)
%14 = load %struct.crypt_device*, %struct.crypt_device** %2
%15 = call i32 @logger(%struct.crypt_device* %14, i32 0, i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0), i32 923, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = load %struct.crypt_device*, %struct.crypt_device** %2
%17 = call i32 @crypt_free(%struct.crypt_device* %16)
br label %18
18: ; preds = %1, %6
ret i32 %4
}